From: Stefan Bund Date: Sat, 24 Oct 2009 13:47:19 +0000 (+0200) Subject: Site and email settings X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=e193b96995f71efca861279483b6985b222940ca;p=zope-bootstrap.git Site and email settings --- diff --git a/src/koehsel.policy/koehsel/policy/profiles/default/mailhost.xml b/src/koehsel.policy/koehsel/policy/profiles/default/mailhost.xml new file mode 100644 index 0000000..158e123 --- /dev/null +++ b/src/koehsel.policy/koehsel/policy/profiles/default/mailhost.xml @@ -0,0 +1,3 @@ + + diff --git a/src/koehsel.policy/koehsel/policy/profiles/default/properties.xml b/src/koehsel.policy/koehsel/policy/profiles/default/properties.xml new file mode 100644 index 0000000..b877054 --- /dev/null +++ b/src/koehsel.policy/koehsel/policy/profiles/default/properties.xml @@ -0,0 +1,15 @@ + + + Köhsel & Sohn + + front-page + + + + + webmaster@localhost + Site Administrator + True + utf-8 + False + diff --git a/src/koehsel.policy/koehsel/policy/setuphandlers.py b/src/koehsel.policy/koehsel/policy/setuphandlers.py index e99f39b..c37da6a 100644 --- a/src/koehsel.policy/koehsel/policy/setuphandlers.py +++ b/src/koehsel.policy/koehsel/policy/setuphandlers.py @@ -10,47 +10,13 @@ INSTALL_PRODUCTS = [ ] SITE_OWNER = 'admin' +SITE_NAME = 'site' -def makeObject(container, type_name, id, **kw): - """Create an object in CONTAINER with type TYPE_NAME and id ID. Additional keyword args -specify additional factory arguments. After creation, the object is published if needed.""" - id = container.invokeFactory(id=id, type_name=type_name, **kw) - ob = getattr(container,id) - event.notify(ObjectInitializedEvent(ob)) - if hasattr(aq_base(ob), 'at_post_create_script'): - ob.at_post_create_script() - if hasattr(aq_base(ob), 'manage_afterPortalFactoryCreate'): - ob.manage_afterPortalFactoryCreate() - return ob - - -def siteSetup(context): - - if context.readDataFile('koehsel.policy_setup.txt') is None: - return - - site = context.getSite() - qi = getToolByName(site, 'portal_quickinstaller') - - # Install EasyShop product - - for p in INSTALL_PRODUCTS: - if not qi.isProductInstalled(p): - qi.installProduct(p) - - # Enable Self-Registration - - scpa = SecurityControlPanelAdapter(site) - scpa.set_enable_self_reg(True) - - # If not already installed, initialize development content +def siteSetupContent(site): try: site.shop - except AttributeError: - siteSetupContent(site) - - -def siteSetupContent(site): + except AttributeError: pass + else: return wf = getToolByName(site, 'portal_workflow') @@ -86,23 +52,61 @@ def siteSetupContent(site): member.setMemberProperties({'fullname': 'Shop Testuser'}) +def makeObject(container, type_name, id, **kw): + """Create an object in CONTAINER with type TYPE_NAME and id ID. Additional keyword args +specify additional factory arguments. After creation, the object is published if needed.""" + id = container.invokeFactory(id=id, type_name=type_name, **kw) + ob = getattr(container,id) + event.notify(ObjectInitializedEvent(ob)) + if hasattr(aq_base(ob), 'at_post_create_script'): + ob.at_post_create_script() + if hasattr(aq_base(ob), 'manage_afterPortalFactoryCreate'): + ob.manage_afterPortalFactoryCreate() + return ob + + +def siteSetup(context): + + if context.readDataFile('koehsel.policy_setup.txt') is None: + return + + site = context.getSite() + qi = getToolByName(site, 'portal_quickinstaller') + + # Install EasyShop product + + for p in INSTALL_PRODUCTS: + if not qi.isProductInstalled(p): + qi.installProduct(p) + + # Enable Self-Registration + + scpa = SecurityControlPanelAdapter(site) + scpa.set_enable_self_reg(True) + + # If not already installed, initialize development content + + siteSetupContent(site) + + def contentSetup(app): - app.manage_addProduct['CMFPlone'].addPloneSite(id='site', + app.manage_addProduct['CMFPlone'].addPloneSite(id=SITE_NAME, extension_ids=['koehsel.policy:default']) # Called via hackery in __init__.py on every site start def appInit(app): - try: app.site - except AttributeError: - - from Testing.makerequest import makerequest - from AccessControl.SecurityManagement import newSecurityManager - import transaction, AccessControl - - # Call 'contentSetup' as SITE_OWNER user with a valid REQUEST - req = makerequest(app) - newSecurityManager(req.REQUEST, app.acl_users.getUserById(SITE_OWNER).__of__(app.acl_users)) - contentSetup(req) - transaction.commit() - newSecurityManager(None, AccessControl.User.system) + try: getattr(app,SITE_NAME) + except AttributeError: pass + else: return + + from Testing.makerequest import makerequest + from AccessControl.SecurityManagement import newSecurityManager + import transaction, AccessControl + + # Call 'contentSetup' as SITE_OWNER user with a valid REQUEST + req = makerequest(app) + newSecurityManager(req.REQUEST, app.acl_users.getUserById(SITE_OWNER).__of__(app.acl_users)) + contentSetup(req) + transaction.commit() + newSecurityManager(None, AccessControl.User.system)