Last change
on this file since 205 was
1,
checked in by myroslav, 18 years ago
|
Building directory structure
|
File size:
1.1 KB
|
Line | |
---|
1 | ## Script (Python) "prefs_comments_setup" |
---|
2 | ##bind container=container |
---|
3 | ##bind context=context |
---|
4 | ##bind namespace= |
---|
5 | ##bind script=script |
---|
6 | ##bind subpath=traverse_subpath |
---|
7 | ##parameters= |
---|
8 | ##title= |
---|
9 | ## |
---|
10 | from Products.CMFCore.utils import getToolByName |
---|
11 | from Products.qPloneComments.utils import setAnonymCommenting |
---|
12 | |
---|
13 | form = context.REQUEST.form |
---|
14 | pp = getToolByName(context, 'portal_properties') |
---|
15 | props_sheet = getattr(pp, 'qPloneComments') |
---|
16 | property_maps=[(m['id'], m['type']) for m in props_sheet.propertyMap() if not m['id']=='title'] |
---|
17 | request_ids = form.keys() |
---|
18 | |
---|
19 | kw={} |
---|
20 | for id,type in property_maps: |
---|
21 | if type == 'boolean': |
---|
22 | if id in request_ids: |
---|
23 | kw[id] = True |
---|
24 | else: |
---|
25 | kw[id] = False |
---|
26 | |
---|
27 | # Switch anonymouse commenting |
---|
28 | if id == 'enable_anonymous_commenting': |
---|
29 | allow = False |
---|
30 | if id in request_ids: |
---|
31 | allow = True |
---|
32 | setAnonymCommenting(context, allow) |
---|
33 | else: |
---|
34 | if id in request_ids: |
---|
35 | kw[id] = form[id] |
---|
36 | |
---|
37 | props_sheet.manage_changeProperties(kw) |
---|
38 | |
---|
39 | return state.set(portal_status_message='qPloneComments configuration changes saved.') |
---|
Note: See
TracBrowser
for help on using the repository browser.