From: Stefan Bund Date: Wed, 21 Oct 2009 13:23:04 +0000 (+0200) Subject: Fix extension installation ordering (fixes layer order) X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=d98e4b951d121fff66448024b8a54d43a2506a2f;p=zope-bootstrap.git Fix extension installation ordering (fixes layer order) --- diff --git a/Makefile b/Makefile index 31446b9..66bf7c1 100644 --- a/Makefile +++ b/Makefile @@ -22,5 +22,17 @@ local.cfg: echo " \$${local:eggs}" \ ) >$@ || (rm -f $@; false) .PHONY: local.cfg +# Not phony in reality but needs to be considered out-of-date whenever called otherupdate:: local.cfg + +instance: update-nonet + bin/instance foreground +.PHONY: instance + +newinstance: purgeinstance instance +.PHONY: newinstance + +purgeinstance: + rm -rf parts/instance var/filestorage +.PHONY: purgeinstance diff --git a/src/koehsel.policy/koehsel/policy/__init__.py b/src/koehsel.policy/koehsel/policy/__init__.py index b5e70dc..885066c 100644 --- a/src/koehsel.policy/koehsel/policy/__init__.py +++ b/src/koehsel.policy/koehsel/policy/__init__.py @@ -2,24 +2,12 @@ import setuphandlers import OFS.Application from App.Product import doInstall import transaction -from AccessControl.SecurityManagement import newSecurityManager -import AccessControl -from Testing.makerequest import makerequest orig_install_standards = None def install_standards(app): orig_install_standards(app) - transaction.commit() - - # Log in as 'admin' user - newSecurityManager(None, app.acl_users.getUser('admin')) - setuphandlers.appInit(makerequest(app)) - transaction.commit() - - # Back to system user - newSecurityManager(None, AccessControl.User.system) - + setuphandlers.appInit(app) def initialize(context): """Initializer called when used as a Zope 2 product.""" diff --git a/src/koehsel.policy/koehsel/policy/profiles/default/metadata.xml b/src/koehsel.policy/koehsel/policy/profiles/default/metadata.xml index 5273b2c..cf4492a 100644 --- a/src/koehsel.policy/koehsel/policy/profiles/default/metadata.xml +++ b/src/koehsel.policy/koehsel/policy/profiles/default/metadata.xml @@ -1,7 +1,4 @@ 1 - - profile-koehsel.theme:default - diff --git a/src/koehsel.policy/koehsel/policy/setuphandlers.py b/src/koehsel.policy/koehsel/policy/setuphandlers.py index 22b3a87..dc45961 100644 --- a/src/koehsel.policy/koehsel/policy/setuphandlers.py +++ b/src/koehsel.policy/koehsel/policy/setuphandlers.py @@ -1,6 +1,11 @@ from Products.CMFCore.utils import getToolByName -INSTALL_PRODUCTS = ['easyshop.core'] +INSTALL_PRODUCTS = [ + 'easyshop.core', + 'koehsel.theme', +] + +SITE_OWNER = 'admin' def siteSetup(context): @@ -8,10 +13,11 @@ def siteSetup(context): return site = context.getSite() + qi = getToolByName(site, 'portal_quickinstaller') + wf = getToolByName(site, 'portal_workflow') # Install EasyShop product - qi = getToolByName(site, 'portal_quickinstaller') for p in INSTALL_PRODUCTS: if not qi.isProductInstalled(p): qi.installProduct(p) @@ -24,7 +30,6 @@ def siteSetup(context): shop = site.shop shop.title = 'Shop' shop.shopOwner = 'admin' - wf = getToolByName(site, 'portal_workflow') if wf.getInfoFor(shop,'review_state','') != 'published': wf.doActionFor(shop,'publish',comment='site setup') @@ -36,9 +41,23 @@ def siteSetup(context): wf.doActionFor(ob,'retract',comment='site setup') -# Called via hackery in __init__.py +def contentSetup(app): + app.manage_addProduct['CMFPlone'].addPloneSite(id='site', + extension_ids=['koehsel.policy:default']) + + +# Called via hackery in __init__.py on every site start def appInit(app): try: app.site except AttributeError: - app.manage_addProduct['CMFPlone'].addPloneSite(id='site', - extension_ids=['koehsel.policy:default']) + + 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.getUser(SITE_OWNER).__of__(app.acl_users)) + contentSetup(req) + transaction.commit() + newSecurityManager(None, AccessControl.User.system)