source: products/qPloneComments/branches/plone-2.1/skins/qplonecomments/prefs_comments_setup.cpy @ 1

Last change on this file since 1 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##
10from Products.CMFCore.utils import getToolByName
11from Products.qPloneComments.utils import setAnonymCommenting
12
13form = context.REQUEST.form
14pp = getToolByName(context, 'portal_properties')
15props_sheet = getattr(pp, 'qPloneComments')
16property_maps=[(m['id'], m['type']) for m in props_sheet.propertyMap() if not m['id']=='title']
17request_ids = form.keys()
18
19kw={}
20for 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
37props_sheet.manage_changeProperties(kw)
38
39return state.set(portal_status_message='qPloneComments configuration changes saved.')
Note: See TracBrowser for help on using the repository browser.