products/CpsDemoPortal

view factory.py @ 1:94ca912fb3aa

Added the CPSTramline:cpsdefault-all profile in the metaprofile
author M.-A. Darche <ma.darche@aful.org>
date Mon, 13 Dec 2010 10:40:38 +0000
parents ca2d7838c01c
children 09662502fd06
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 'CPSTramline:cpsdefault-all',
37 'CpsDemoPortal:default',
38 ),
39 'optional' : False,
40 'parameters' : {'attributes': ('smtp_host',
41 'smtp_port',
42 'smtp_pwd',
43 'smtp_uid'),
44 'class': 'Products.MailHost.'
45 'MailHost.MailHost',
46 'rpath' : 'MailHost'},
47 }
48 }
49 metas_order = ('CPS_DEMO',
50 )
51 form_heading = "Add CPS demo portal"
52 post_action = 'addConfiguredCpsDemoPortal'
54 _cpsconfigurator = SiteConfigurator()
56 # GR: straight from CPSDefault.factory
57 # Do the following dance because bound methods don't play well with
58 # constructors registered for products.
60 def addConfiguredCpsDemoPortalForm(dispatcher):
61 """Form to add a CPS Site from ZMI.
62 """
63 return _cpsconfigurator.addConfiguredSiteForm(dispatcher)
65 def addConfiguredCpsDemoPortal(dispatcher, REQUEST=None, **kw):
66 """Add a CPSSite according to profile and extensions.
67 """
68 if REQUEST is not None:
69 kw.update(REQUEST.form)
70 return _cpsconfigurator.addConfiguredSite(dispatcher,
71 REQUEST=REQUEST, **kw)