Last change
on this file since 689 was
689,
checked in by chervol, 17 years ago
|
retagging
|
-
Property svn:eol-style set to
native
|
File size:
829 bytes
|
Line | |
---|
1 | from urlparse import urlsplit |
---|
2 | |
---|
3 | from Products.CMFCore.utils import getToolsByName |
---|
4 | |
---|
5 | from config import * |
---|
6 | |
---|
7 | def setSkin(site, event): |
---|
8 | ps = getToolsByName(site,'portal_skins') |
---|
9 | |
---|
10 | if USE_FS_CONFIG: |
---|
11 | pref = SKIN_SWITCH_PREFIX |
---|
12 | switch_theme = SWITCH_THEME |
---|
13 | else: |
---|
14 | pp = getToolsByName(site,'portal_properties') |
---|
15 | ss = getattr(pp,'skin_switcher',None) |
---|
16 | if not ss: |
---|
17 | return |
---|
18 | pref = ss.getProperty('theme_switch_prefix', SKIN_SWITCH_PREFIX) |
---|
19 | switch_theme = ss.getProperty('switch_theme', SWITCH_THEME) |
---|
20 | |
---|
21 | avail_skins = ps.getSkinSelections() |
---|
22 | if not (pref and switch_theme and switch_theme in avail_skins): |
---|
23 | return |
---|
24 | |
---|
25 | scheme, netloc, path, query, fragm = urlsplit(event.request.URL) |
---|
26 | if netloc.startswith(pref): |
---|
27 | site.changeSkin(switch_theme) |
---|
Note: See
TracBrowser
for help on using the repository browser.