[Checkins] SVN: Products.CMFCore/branches/2.2/Products/CMFCore/ - Changed GenericSetup import handlers to fail silently if they
Jens Vagelpohl
jens at dataflake.org
Wed Dec 30 10:33:55 EST 2009
Log message for revision 107359:
- Changed GenericSetup import handlers to fail silently if they
are called in a context that does not contain the items they
import.
Changed:
U Products.CMFCore/branches/2.2/Products/CMFCore/CHANGES.txt
U Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/actions.py
U Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/cachingpolicymgr.py
U Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/catalog.py
U Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/contenttyperegistry.py
U Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/cookieauth.py
U Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/mailhost.py
U Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/skins.py
U Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/typeinfo.py
U Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/workflow.py
-=-
Modified: Products.CMFCore/branches/2.2/Products/CMFCore/CHANGES.txt
===================================================================
--- Products.CMFCore/branches/2.2/Products/CMFCore/CHANGES.txt 2009-12-30 15:29:15 UTC (rev 107358)
+++ Products.CMFCore/branches/2.2/Products/CMFCore/CHANGES.txt 2009-12-30 15:33:55 UTC (rev 107359)
@@ -4,7 +4,11 @@
2.2.0 (unreleased)
------------------
+- Changed GenericSetup import handlers to fail silently if they
+ are called in a context that does not contain the items they
+ import.
+
2.2.0-beta (2009-12-06)
-----------------------
Modified: Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/actions.py
===================================================================
--- Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/actions.py 2009-12-30 15:29:15 UTC (rev 107358)
+++ Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/actions.py 2009-12-30 15:33:55 UTC (rev 107359)
@@ -260,7 +260,11 @@
"""Import actions tool.
"""
site = context.getSite()
- tool = getToolByName(site, 'portal_actions')
+ tool = getToolByName(site, 'portal_actions', None)
+ if tool is None:
+ logger = context.getLogger('actions')
+ logger.debug('Nothing to import.')
+ return
importObjects(tool, '', context)
Modified: Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/cachingpolicymgr.py
===================================================================
--- Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/cachingpolicymgr.py 2009-12-30 15:29:15 UTC (rev 107358)
+++ Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/cachingpolicymgr.py 2009-12-30 15:33:55 UTC (rev 107359)
@@ -174,9 +174,12 @@
"""
site = context.getSite()
tool = getToolByName(site, 'caching_policy_manager', None)
+ if tool is None:
+ logger = context.getLogger('cachingpolicies')
+ logger.debug('Nothing to import.')
+ return
- if tool is not None:
- importObjects(tool, '', context)
+ importObjects(tool, '', context)
def exportCachingPolicyManager(context):
"""Export caching policy manager settings as an XML file.
Modified: Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/catalog.py
===================================================================
--- Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/catalog.py 2009-12-30 15:29:15 UTC (rev 107358)
+++ Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/catalog.py 2009-12-30 15:33:55 UTC (rev 107359)
@@ -25,7 +25,11 @@
"""Import catalog tool.
"""
site = context.getSite()
- tool = getToolByName(site, 'portal_catalog')
+ tool = getToolByName(site, 'portal_catalog', None)
+ if tool is None:
+ logger = context.getLogger('catalog')
+ logger.debug('Nothing to import.')
+ return
importObjects(tool, '', context)
Modified: Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/contenttyperegistry.py
===================================================================
--- Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/contenttyperegistry.py 2009-12-30 15:29:15 UTC (rev 107358)
+++ Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/contenttyperegistry.py 2009-12-30 15:33:55 UTC (rev 107359)
@@ -112,7 +112,11 @@
"""Import content type registry settings from an XML file.
"""
site = context.getSite()
- tool = getToolByName(site, 'content_type_registry')
+ tool = getToolByName(site, 'content_type_registry', None)
+ if tool is None:
+ logger = context.getLogger('contenttypes')
+ logger.debug('Nothing to import.')
+ return
importObjects(tool, '', context)
Modified: Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/cookieauth.py
===================================================================
--- Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/cookieauth.py 2009-12-30 15:29:15 UTC (rev 107358)
+++ Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/cookieauth.py 2009-12-30 15:33:55 UTC (rev 107359)
@@ -65,7 +65,7 @@
tool = getToolByName(site, 'cookie_authentication', None)
if tool is None:
logger = context.getLogger('cookies')
- logger.debug('Nothing cookie tool to import.')
+ logger.debug('Nothing to import.')
return
importObjects(tool, '', context)
Modified: Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/mailhost.py
===================================================================
--- Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/mailhost.py 2009-12-30 15:29:15 UTC (rev 107358)
+++ Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/mailhost.py 2009-12-30 15:33:55 UTC (rev 107359)
@@ -27,7 +27,11 @@
"""Import mailhost settings from an XML file.
"""
sm = getSiteManager(context.getSite())
- tool = sm.getUtility(IMailHost)
+ tool = sm.queryUtility(IMailHost)
+ if tool is None:
+ logger = context.getLogger('mailhost')
+ logger.debug('Nothing to import.')
+ return
importObjects(tool, '', context)
Modified: Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/skins.py
===================================================================
--- Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/skins.py 2009-12-30 15:29:15 UTC (rev 107358)
+++ Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/skins.py 2009-12-30 15:33:55 UTC (rev 107359)
@@ -220,7 +220,11 @@
"""Import skins tool FSDirViews and skin paths from an XML file.
"""
site = context.getSite()
- tool = getToolByName(site, 'portal_skins')
+ tool = getToolByName(site, 'portal_skins', None)
+ if tool is None:
+ logger = context.getLogger('skins')
+ logger.debug('Nothing to import.')
+ return
importObjects(tool, '', context)
Modified: Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/typeinfo.py
===================================================================
--- Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/typeinfo.py 2009-12-30 15:29:15 UTC (rev 107358)
+++ Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/typeinfo.py 2009-12-30 15:33:55 UTC (rev 107359)
@@ -215,7 +215,11 @@
"""Import types tool and content types from XML files.
"""
site = context.getSite()
- tool = getToolByName(site, 'portal_types')
+ tool = getToolByName(site, 'portal_types', None)
+ if tool is None:
+ logger = context.getLogger('types')
+ logger.debug('Nothing to import.')
+ return
importObjects(tool, '', context)
Modified: Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/workflow.py
===================================================================
--- Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/workflow.py 2009-12-30 15:29:15 UTC (rev 107358)
+++ Products.CMFCore/branches/2.2/Products/CMFCore/exportimport/workflow.py 2009-12-30 15:33:55 UTC (rev 107359)
@@ -121,7 +121,11 @@
"""Import workflow tool and contained workflow definitions from XML files.
"""
site = context.getSite()
- tool = getToolByName(site, 'portal_workflow')
+ tool = getToolByName(site, 'portal_workflow', None)
+ if tool is None:
+ logger = context.getLogger('workflow')
+ logger.debug('Nothing to import.')
+ return
importObjects(tool, '', context)
More information about the checkins
mailing list