1 from Products.CMFCore.utils import getToolByName
3 INSTALL_PRODUCTS = ['easyshop.core']
5 def siteSetup(context):
7 if context.readDataFile('koehsel.policy_setup.txt') is None:
10 site = context.getSite()
12 # Install EasyShop product
14 qi = getToolByName(site, 'portal_quickinstaller')
15 for p in INSTALL_PRODUCTS:
16 if not qi.isProductInstalled(p):
19 # Add and publish shop instance
22 except AttributeError:
23 site.invokeFactory(id='shop', type_name='EasyShop')
26 shop.shopOwner = 'admin'
27 wf = getToolByName(site, 'portal_workflow')
28 if wf.getInfoFor(shop,'review_state','') != 'published':
29 wf.doActionFor(shop,'publish',comment='site setup')
31 # Hide Users, News and Events
33 for id in ('Members', 'news', 'events'):
35 if wf.getInfoFor(ob,'review_state','') != 'private':
36 wf.doActionFor(ob,'retract',comment='site setup')
39 # Called via hackery in __init__.py
42 except AttributeError:
43 app.manage_addProduct['CMFPlone'].addPloneSite(id='site',
44 extension_ids=['koehsel.policy:default'])