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