products/CpsDemoPortal

view factory.py @ 0:ca2d7838c01c

First import
author M.-A. Darche <ma.darche@aful.org>
date Sun, 12 Dec 2010 20:41:12 +0000
parents
children 94ca912fb3aa
line source
1 # (C) Copyright 2010 CPS-CMS community <http://cps-cms.org/>
2 # Authors:
3 # M.-A. Darche <cps@cynode.org>
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 """CPS demo portal factory."""
19 from Products.CPSDefault.metafactory import CPSSiteMetaConfigurator
21 #
22 # Callables for meta profiles
23 #
25 def removeCookieCrumbler(site):
26 site.manage_delObjects(['cookie_authentication'])
28 class SiteConfigurator(CPSSiteMetaConfigurator):
29 """CPS demo portal configurator"""
31 meta_profiles = {
32 'CPS_DEMO': {'title' : 'Common set of components',
33 'extensions': ('CPSRSS:default',
34 'CPSSubscriptions:default',
35 'CPSDefault:folder_advanced_display',
36 'CpsDemoPortal:default',
37 ),
38 'optional' : False,
39 'parameters' : {'attributes': ('smtp_host',
40 'smtp_port',
41 'smtp_pwd',
42 'smtp_uid'),
43 'class': 'Products.MailHost.'
44 'MailHost.MailHost',
45 'rpath' : 'MailHost'},
46 }
47 }
48 metas_order = ('CPS_COMMUNITY',
49 )
50 form_heading = "Add CPS demo portal"
51 post_action = 'addConfiguredCpsDemoPortal'
53 _cpsconfigurator = SiteConfigurator()
55 # GR: straight from CPSDefault.factory
56 # Do the following dance because bound methods don't play well with
57 # constructors registered for products.
59 def addConfiguredCpsDemoPortalForm(dispatcher):
60 """Form to add a CPS Site from ZMI.
61 """
62 return _cpsconfigurator.addConfiguredSiteForm(dispatcher)
64 def addConfiguredCpsDemoPortal(dispatcher, REQUEST=None, **kw):
65 """Add a CPSSite according to profile and extensions.
66 """
67 if REQUEST is not None:
68 kw.update(REQUEST.form)
69 return _cpsconfigurator.addConfiguredSite(dispatcher,
70 REQUEST=REQUEST, **kw)