[CMF-checkins] SVN: CMF/branches/1.6/ backported r40715 from trunk:
Yvo Schubbe
y.2005- at wcm-solutions.de
Mon Dec 12 06:02:25 EST 2005
Log message for revision 40716:
backported r40715 from trunk:
- converted node adapters to multi adapters
- updated adapter registration
- updated add views that depend on GenericSetup.browser
Changed:
U CMF/branches/1.6/CMFCore/browser/configure.zcml
U CMF/branches/1.6/CMFCore/browser/typeinfo.py
U CMF/branches/1.6/CMFCore/exportimport/actions.py
U CMF/branches/1.6/CMFCore/exportimport/cachingpolicymgr.py
U CMF/branches/1.6/CMFCore/exportimport/configure.zcml
U CMF/branches/1.6/CMFCore/exportimport/contenttyperegistry.py
U CMF/branches/1.6/CMFCore/exportimport/cookieauth.py
U CMF/branches/1.6/CMFCore/exportimport/properties.py
U CMF/branches/1.6/CMFCore/exportimport/skins.py
U CMF/branches/1.6/CMFCore/exportimport/tests/test_skins.py
U CMF/branches/1.6/CMFCore/exportimport/tests/test_workflow.py
U CMF/branches/1.6/CMFCore/exportimport/typeinfo.py
U CMF/branches/1.6/CMFCore/exportimport/workflow.py
U CMF/branches/1.6/DCWorkflow/browser/workflow.py
U CMF/branches/1.6/DCWorkflow/configure.zcml
-=-
Modified: CMF/branches/1.6/CMFCore/browser/configure.zcml
===================================================================
--- CMF/branches/1.6/CMFCore/browser/configure.zcml 2005-12-12 10:33:40 UTC (rev 40715)
+++ CMF/branches/1.6/CMFCore/browser/configure.zcml 2005-12-12 11:02:25 UTC (rev 40716)
@@ -4,10 +4,10 @@
xmlns:five="http://namespaces.zope.org/five"
>
+ <five:traversable class="Products.CMFCore.TypesTool.TypesTool"/>
+
<five:traversable class="Products.CMFCore.WorkflowTool.WorkflowTool"/>
- <five:traversable class="Products.CMFCore.TypesTool.TypesTool"/>
-
<configure package="Products.GenericSetup.browser">
<browser:page
Modified: CMF/branches/1.6/CMFCore/browser/typeinfo.py
===================================================================
--- CMF/branches/1.6/CMFCore/browser/typeinfo.py 2005-12-12 10:33:40 UTC (rev 40715)
+++ CMF/branches/1.6/CMFCore/browser/typeinfo.py 2005-12-12 11:02:25 UTC (rev 40716)
@@ -63,7 +63,7 @@
'obj_ids': tuple(obj_ids)})
return tuple(profiles)
- def _initSettings(self, obj, profile_id, obj_id):
+ def _initSettings(self, obj, profile_id, obj_path):
stool = getToolByName(self, 'portal_setup', None)
if stool is None:
return
@@ -80,7 +80,7 @@
new_id = root.getAttribute('name')
if not new_id:
new_id = root.getAttribute('id')
- if new_id != obj_id:
+ if new_id != obj_path[0]:
continue
if root.getAttribute('meta_type') != self.klass.meta_type:
Modified: CMF/branches/1.6/CMFCore/exportimport/actions.py
===================================================================
--- CMF/branches/1.6/CMFCore/exportimport/actions.py 2005-12-12 10:33:40 UTC (rev 40715)
+++ CMF/branches/1.6/CMFCore/exportimport/actions.py 2005-12-12 11:02:25 UTC (rev 40716)
@@ -18,7 +18,6 @@
from zope.app import zapi
from Products.GenericSetup.interfaces import IBody
-from Products.GenericSetup.interfaces import PURGE
from Products.GenericSetup.utils import XMLAdapterBase
from Products.CMFCore.interfaces import IActionProvider
@@ -39,23 +38,22 @@
_LOGGER_ID = 'actions'
- def exportNode(self, doc):
+ def _exportNode(self):
"""Export the object as a DOM node.
"""
- self._doc = doc
node = self._getObjectNode('object')
node.appendChild(self._extractProviders())
self._logger.info('Actions tool exported.')
return node
- def importNode(self, node, mode=PURGE):
+ def _importNode(self, node):
"""Import the object from the DOM node.
"""
- if mode == PURGE:
+ if self.environ.shouldPurge():
self._purgeProviders()
- self._initProviders(node, mode)
+ self._initProviders(node)
self._logger.info('Actions tool imported.')
@@ -107,7 +105,7 @@
for provider_id in self.context.listActionProviders():
self.context.deleteActionProvider(provider_id)
- def _initProviders(self, node, mode):
+ def _initProviders(self, node):
for child in node.childNodes:
if child.nodeName != 'action-provider':
continue
@@ -131,9 +129,9 @@
provider.deleteActions(range(0,num_actions))
# BBB: for CMF 1.5 profiles
- self._initOldstyleActions(child, mode)
+ self._initOldstyleActions(child)
- def _initOldstyleActions(self, node, mode):
+ def _initOldstyleActions(self, node):
# BBB: for CMF 1.5 profiles
provider_id = str(node.getAttribute('name'))
if not provider_id:
Modified: CMF/branches/1.6/CMFCore/exportimport/cachingpolicymgr.py
===================================================================
--- CMF/branches/1.6/CMFCore/exportimport/cachingpolicymgr.py 2005-12-12 10:33:40 UTC (rev 40715)
+++ CMF/branches/1.6/CMFCore/exportimport/cachingpolicymgr.py 2005-12-12 11:02:25 UTC (rev 40716)
@@ -18,9 +18,7 @@
from zope.app import zapi
from Products.GenericSetup.interfaces import IBody
-from Products.GenericSetup.interfaces import INodeExporter
-from Products.GenericSetup.interfaces import INodeImporter
-from Products.GenericSetup.interfaces import PURGE
+from Products.GenericSetup.interfaces import INode
from Products.GenericSetup.utils import NodeAdapterBase
from Products.GenericSetup.utils import XMLAdapterBase
@@ -38,10 +36,9 @@
__used_for__ = ICachingPolicy
- def exportNode(self, doc):
+ def _exportNode(self):
"""Export the object as a DOM node.
"""
- self._doc = doc
obj = self.context
node = self._doc.createElement('caching-policy')
node.setAttribute('name', obj.getPolicyId())
@@ -72,7 +69,7 @@
node.setAttribute('post_check', str(post_check))
return node
- def importNode(self, node, mode=PURGE):
+ def _importNode(self, node):
"""Import the object from the DOM node.
"""
info = {}
@@ -113,7 +110,9 @@
info['post_check'] = int(post_check)
self.context.__init__(**info)
+ node = property(_exportNode, _importNode)
+
class CachingPolicyManagerXMLAdapter(XMLAdapterBase):
"""XML im- and exporter for CachingPolicyManager.
@@ -123,39 +122,37 @@
_LOGGER_ID = 'cachingpolicies'
- def exportNode(self, doc):
+ def _exportNode(self):
"""Export the object as a DOM node.
"""
- self._doc = doc
node = self._getObjectNode('object')
node.appendChild(self._extractCachingPolicies())
self._logger.info('Caching policy manager exported.')
return node
- def importNode(self, node, mode=PURGE):
+ def _importNode(self, node):
"""Import the object from the DOM node.
"""
- if mode == PURGE:
+ if self.environ.shouldPurge():
self._purgeCachingPolicies()
- self._initCachingPolicies(node, mode)
+ self._initCachingPolicies(node)
self._logger.info('Caching policy manager imported.')
def _extractCachingPolicies(self):
fragment = self._doc.createDocumentFragment()
for policy_id, policy in self.context.listPolicies():
- exporter = INodeExporter(policy, None)
- if exporter is None:
- continue
- fragment.appendChild(exporter.exportNode(self._doc))
+ exporter = zapi.queryMultiAdapter((policy, self.environ), INode)
+ if exporter:
+ fragment.appendChild(exporter.node)
return fragment
def _purgeCachingPolicies(self):
self.context.__init__()
- def _initCachingPolicies(self, node, mode):
+ def _initCachingPolicies(self, node):
for child in node.childNodes:
if child.nodeName != 'caching-policy':
continue
@@ -167,7 +164,9 @@
0, 0, 0, 0, '', '')
policy = self.context._policies[policy_id]
- INodeImporter(policy).importNode(child, mode)
+ importer = zapi.queryMultiAdapter((policy, self.environ), INode)
+ if importer:
+ importer.node = child
def importCachingPolicyManager(context):
Modified: CMF/branches/1.6/CMFCore/exportimport/configure.zcml
===================================================================
--- CMF/branches/1.6/CMFCore/exportimport/configure.zcml 2005-12-12 10:33:40 UTC (rev 40715)
+++ CMF/branches/1.6/CMFCore/exportimport/configure.zcml 2005-12-12 11:02:25 UTC (rev 40716)
@@ -6,26 +6,21 @@
factory=".actions.ActionsToolXMLAdapter"
provides="Products.GenericSetup.interfaces.IBody"
for="Products.CMFCore.interfaces.IActionsTool
- Products.GenericSetup.interfaces.ISetupContext"
+ Products.GenericSetup.interfaces.ISetupEnviron"
/>
<adapter
factory=".cachingpolicymgr.CachingPolicyNodeAdapter"
- provides="Products.GenericSetup.interfaces.INodeExporter"
- for="Products.CMFCore.interfaces.ICachingPolicy"
+ provides="Products.GenericSetup.interfaces.INode"
+ for="Products.CMFCore.interfaces.ICachingPolicy
+ Products.GenericSetup.interfaces.ISetupEnviron"
/>
<adapter
- factory=".cachingpolicymgr.CachingPolicyNodeAdapter"
- provides="Products.GenericSetup.interfaces.INodeImporter"
- for="Products.CMFCore.interfaces.ICachingPolicy"
- />
-
- <adapter
factory=".cachingpolicymgr.CachingPolicyManagerXMLAdapter"
provides="Products.GenericSetup.interfaces.IBody"
for="Products.CMFCore.interfaces.ICachingPolicyManager
- Products.GenericSetup.interfaces.ISetupContext"
+ Products.GenericSetup.interfaces.ISetupEnviron"
/>
<adapter
@@ -44,61 +39,56 @@
factory=".contenttyperegistry.ContentTypeRegistryXMLAdapter"
provides="Products.GenericSetup.interfaces.IBody"
for="Products.CMFCore.interfaces.IContentTypeRegistry
- Products.GenericSetup.interfaces.ISetupContext"
+ Products.GenericSetup.interfaces.ISetupEnviron"
/>
<adapter
factory=".cookieauth.CookieCrumblerXMLAdapter"
provides="Products.GenericSetup.interfaces.IBody"
for="Products.CMFCore.interfaces.ICookieCrumbler
- Products.GenericSetup.interfaces.ISetupContext"
+ Products.GenericSetup.interfaces.ISetupEnviron"
/>
<adapter
factory=".properties.PropertiesXMLAdapter"
provides="Products.GenericSetup.interfaces.IBody"
for="Products.CMFCore.interfaces.ISiteRoot
- Products.GenericSetup.interfaces.ISetupContext"
+ Products.GenericSetup.interfaces.ISetupEnviron"
/>
<adapter
factory=".skins.DirectoryViewNodeAdapter"
- provides="Products.GenericSetup.interfaces.INodeExporter"
- for="Products.CMFCore.interfaces.IDirectoryView"
+ provides="Products.GenericSetup.interfaces.INode"
+ for="Products.CMFCore.interfaces.IDirectoryView
+ Products.GenericSetup.interfaces.ISetupEnviron"
/>
<adapter
- factory=".skins.DirectoryViewNodeAdapter"
- provides="Products.GenericSetup.interfaces.INodeImporter"
- for="Products.CMFCore.interfaces.IDirectoryView"
- />
-
- <adapter
factory=".skins.SkinsToolXMLAdapter"
provides="Products.GenericSetup.interfaces.IBody"
for="Products.CMFCore.interfaces.ISkinsTool
- Products.GenericSetup.interfaces.ISetupContext"
+ Products.GenericSetup.interfaces.ISetupEnviron"
/>
<adapter
factory=".typeinfo.TypeInformationXMLAdapter"
provides="Products.GenericSetup.interfaces.IBody"
for="Products.CMFCore.interfaces.ITypeInformation
- Products.GenericSetup.interfaces.ISetupContext"
+ Products.GenericSetup.interfaces.ISetupEnviron"
/>
<adapter
factory=".typeinfo.TypesToolXMLAdapter"
provides="Products.GenericSetup.interfaces.IBody"
for="Products.CMFCore.interfaces.ITypesTool
- Products.GenericSetup.interfaces.ISetupContext"
+ Products.GenericSetup.interfaces.ISetupEnviron"
/>
<adapter
factory=".workflow.WorkflowToolXMLAdapter"
provides="Products.GenericSetup.interfaces.IBody"
for="Products.CMFCore.interfaces.IWorkflowTool
- Products.GenericSetup.interfaces.ISetupContext"
+ Products.GenericSetup.interfaces.ISetupEnviron"
/>
</configure>
Modified: CMF/branches/1.6/CMFCore/exportimport/contenttyperegistry.py
===================================================================
--- CMF/branches/1.6/CMFCore/exportimport/contenttyperegistry.py 2005-12-12 10:33:40 UTC (rev 40715)
+++ CMF/branches/1.6/CMFCore/exportimport/contenttyperegistry.py 2005-12-12 11:02:25 UTC (rev 40716)
@@ -18,7 +18,6 @@
from zope.app import zapi
from Products.GenericSetup.interfaces import IBody
-from Products.GenericSetup.interfaces import PURGE
from Products.GenericSetup.utils import XMLAdapterBase
from Products.CMFCore.interfaces import IContentTypeRegistry
@@ -36,23 +35,22 @@
_LOGGER_ID = 'contenttypes'
- def exportNode(self, doc):
+ def _exportNode(self):
"""Export the object as a DOM node.
"""
- self._doc = doc
node = self._getObjectNode('object')
node.appendChild(self._extractPredicates())
self._logger.info('Content type registry exported.')
return node
- def importNode(self, node, mode=PURGE):
+ def _importNode(self, node):
"""Import the object from the DOM node.
"""
- if mode == PURGE:
+ if self.environ.shouldPurge():
self._purgePredicates()
- self._initPredicates(node, mode)
+ self._initPredicates(node)
self._logger.info('Content type registry imported.')
@@ -73,7 +71,7 @@
def _purgePredicates(self):
self.context.__init__()
- def _initPredicates(self, node, mode):
+ def _initPredicates(self, node):
for child in node.childNodes:
if child.nodeName != 'predicate':
continue
Modified: CMF/branches/1.6/CMFCore/exportimport/cookieauth.py
===================================================================
--- CMF/branches/1.6/CMFCore/exportimport/cookieauth.py 2005-12-12 10:33:40 UTC (rev 40715)
+++ CMF/branches/1.6/CMFCore/exportimport/cookieauth.py 2005-12-12 11:02:25 UTC (rev 40716)
@@ -18,7 +18,6 @@
from zope.app import zapi
from Products.GenericSetup.interfaces import IBody
-from Products.GenericSetup.interfaces import PURGE
from Products.GenericSetup.utils import PropertyManagerHelpers
from Products.GenericSetup.utils import XMLAdapterBase
@@ -37,23 +36,22 @@
_LOGGER_ID = 'cookies'
- def exportNode(self, doc):
+ def _exportNode(self):
"""Export the object as a DOM node.
"""
- self._doc = doc
node = self._getObjectNode('object')
node.appendChild(self._extractProperties())
self._logger.info('Cookie crumbler exported.')
return node
- def importNode(self, node, mode=PURGE):
+ def _importNode(self, node):
"""Import the object from the DOM node.
"""
- if mode == PURGE:
+ if self.environ.shouldPurge():
self._purgeProperties()
- self._initProperties(node, mode)
+ self._initProperties(node)
self._logger.info('Cookie crumbler imported.')
Modified: CMF/branches/1.6/CMFCore/exportimport/properties.py
===================================================================
--- CMF/branches/1.6/CMFCore/exportimport/properties.py 2005-12-12 10:33:40 UTC (rev 40715)
+++ CMF/branches/1.6/CMFCore/exportimport/properties.py 2005-12-12 11:02:25 UTC (rev 40716)
@@ -18,7 +18,6 @@
from zope.app import zapi
from Products.GenericSetup.interfaces import IBody
-from Products.GenericSetup.interfaces import PURGE
from Products.GenericSetup.utils import PropertyManagerHelpers
from Products.GenericSetup.utils import XMLAdapterBase
@@ -36,23 +35,22 @@
_LOGGER_ID = 'properties'
- def exportNode(self, doc):
+ def _exportNode(self):
"""Export the object as a DOM node.
"""
- self._doc = doc
node = self._doc.createElement('site')
node.appendChild(self._extractProperties())
self._logger.info('Site properties exported.')
return node
- def importNode(self, node, mode=PURGE):
+ def _importNode(self, node):
"""Import the object from the DOM node.
"""
- if mode == PURGE:
+ if self.environ.shouldPurge():
self._purgeProperties()
- self._initProperties(node, mode)
+ self._initProperties(node)
self._logger.info('Site properties imported.')
Modified: CMF/branches/1.6/CMFCore/exportimport/skins.py
===================================================================
--- CMF/branches/1.6/CMFCore/exportimport/skins.py 2005-12-12 10:33:40 UTC (rev 40715)
+++ CMF/branches/1.6/CMFCore/exportimport/skins.py 2005-12-12 11:02:25 UTC (rev 40716)
@@ -15,10 +15,11 @@
$Id$
"""
+from Acquisition import aq_inner
+from Acquisition import aq_parent
from zope.app import zapi
from Products.GenericSetup.interfaces import IBody
-from Products.GenericSetup.interfaces import PURGE
from Products.GenericSetup.utils import exportObjects
from Products.GenericSetup.utils import importObjects
from Products.GenericSetup.utils import NodeAdapterBase
@@ -40,20 +41,21 @@
__used_for__ = IDirectoryView
- def exportNode(self, doc):
+ def _exportNode(self):
"""Export the object as a DOM node.
"""
- self._doc = doc
node = self._getObjectNode('object')
node.setAttribute('directory', self.context.getDirPath())
return node
- def importNode(self, node, mode=PURGE):
+ def _importNode(self, node):
"""Import the object from the DOM node.
"""
self.context.manage_properties(str(node.getAttribute('directory')))
+ node = property(_exportNode, _importNode)
+
class SkinsToolXMLAdapter(XMLAdapterBase, ObjectManagerHelpers):
"""XML im- and exporter for SkinsTool.
@@ -63,10 +65,9 @@
_LOGGER_ID = 'skins'
- def exportNode(self, doc):
+ def _exportNode(self):
"""Export the object as a DOM node.
"""
- self._doc = doc
node = self._getObjectNode('object')
node.setAttribute('default_skin', self.context.default_skin)
node.setAttribute('request_varname', self.context.request_varname)
@@ -79,12 +80,12 @@
self._logger.info('Skins tool exported.')
return node
- def importNode(self, node, mode=PURGE):
+ def _importNode(self, node):
"""Import the object from the DOM node.
"""
obj = self.context
- if mode == PURGE:
+ if self.environ.shouldPurge():
obj.default_skin = ''
obj.request_varname = 'portal_skin'
obj.allow_any = 0
@@ -102,13 +103,13 @@
if node.hasAttribute('cookie_persistence'):
persistence = node.getAttribute('cookie_persistence')
obj.cookie_persistence = int(self._convertToBoolean(persistence))
- self._initObjects(node, mode)
- self._initBBBObjects(node, mode)
- self._initSkinPaths(node, mode)
+ self._initObjects(node)
+ self._initBBBObjects(node)
+ self._initSkinPaths(node)
self._logger.info('Skins tool imported.')
- def _initBBBObjects(self, node, mode):
+ def _initBBBObjects(self, node):
for child in node.childNodes:
if child.nodeName != 'skin-directory':
continue
@@ -134,7 +135,7 @@
def _purgeSkinPaths(self):
self.context._getSelections().clear()
- def _initSkinPaths(self, node, mode):
+ def _initSkinPaths(self, node):
for child in node.childNodes:
if child.nodeName != 'skin-path':
continue
@@ -157,13 +158,12 @@
# Purge and rebuild the skin path, now that we have added our stuff.
# Don't bother if no REQUEST is present, e.g. when running unit tests
#
- site = self.environ.getSite()
- request = getattr(site, 'REQUEST', None)
- if request is not None:
- site.clearCurrentSkin()
- site.setupCurrentSkin(request)
+ request = getattr(self.context, 'REQUEST', None)
+ skinnable = aq_parent(aq_inner(self.context))
+ if request is not None and skinnable is not None:
+ skinnable.clearCurrentSkin()
+ skinnable.setupCurrentSkin(request)
-
def _updatePath(self, path, node):
path = [ name.strip() for name in path.split(',') if name.strip() ]
Modified: CMF/branches/1.6/CMFCore/exportimport/tests/test_skins.py
===================================================================
--- CMF/branches/1.6/CMFCore/exportimport/tests/test_skins.py 2005-12-12 10:33:40 UTC (rev 40715)
+++ CMF/branches/1.6/CMFCore/exportimport/tests/test_skins.py 2005-12-12 11:02:25 UTC (rev 40716)
@@ -331,7 +331,8 @@
site = DummySite()
fsdvs = [ (id, DirectoryView(id, 'CMFCore/exportimport/tests/%s' %
id)) for id in ids ]
- site.portal_skins = DummySkinsTool(selections, fsdvs)
+ site._setObject('portal_skins', DummySkinsTool(selections, fsdvs))
+ site.REQUEST = 'exists'
return site
def setUp(self):
Modified: CMF/branches/1.6/CMFCore/exportimport/tests/test_workflow.py
===================================================================
--- CMF/branches/1.6/CMFCore/exportimport/tests/test_workflow.py 2005-12-12 10:33:40 UTC (rev 40715)
+++ CMF/branches/1.6/CMFCore/exportimport/tests/test_workflow.py 2005-12-12 11:02:25 UTC (rev 40716)
@@ -51,7 +51,7 @@
factory="Products.CMFCore.exportimport.tests.test_workflow.DummyWorkflowBodyAdapter"
provides="Products.GenericSetup.interfaces.IBody"
for="Products.CMFCore.interfaces.IWorkflowDefinition
- Products.GenericSetup.interfaces.ISetupContext"
+ Products.GenericSetup.interfaces.ISetupEnviron"
/>
</configure>
"""
@@ -185,7 +185,7 @@
class DummyWorkflowBodyAdapter(BodyAdapterBase):
- pass
+ body = property(BodyAdapterBase._exportBody, BodyAdapterBase._importBody)
class WorkflowToolXMLAdapterTests(BodyAdapterTestCase):
Modified: CMF/branches/1.6/CMFCore/exportimport/typeinfo.py
===================================================================
--- CMF/branches/1.6/CMFCore/exportimport/typeinfo.py 2005-12-12 10:33:40 UTC (rev 40715)
+++ CMF/branches/1.6/CMFCore/exportimport/typeinfo.py 2005-12-12 11:02:25 UTC (rev 40716)
@@ -21,7 +21,6 @@
from zope.app import zapi
from Products.GenericSetup.interfaces import IBody
-from Products.GenericSetup.interfaces import PURGE
from Products.GenericSetup.utils import exportObjects
from Products.GenericSetup.utils import I18NURI
from Products.GenericSetup.utils import importObjects
@@ -45,10 +44,9 @@
_LOGGER_ID = 'types'
- def exportNode(self, doc):
+ def _exportNode(self):
"""Export the object as a DOM node.
"""
- self._doc = doc
node = self._getObjectNode('object')
node.setAttribute('xmlns:i18n', I18NURI)
node.appendChild(self._extractProperties())
@@ -58,18 +56,18 @@
self._logger.info('%r type info exported.' % self.context.getId())
return node
- def importNode(self, node, mode=PURGE):
+ def _importNode(self, node):
"""Import the object from the DOM node.
"""
- if mode == PURGE:
+ if self.environ.shouldPurge():
self._purgeProperties()
self._purgeAliases()
self._purgeActions()
- self._initOldstyleProperties(node, mode)
- self._initProperties(node, mode)
- self._initAliases(node, mode)
- self._initActions(node, mode)
+ self._initOldstyleProperties(node)
+ self._initProperties(node)
+ self._initAliases(node)
+ self._initActions(node)
self._logger.info('%r type info imported.' % self.context.getId())
@@ -87,7 +85,7 @@
def _purgeAliases(self):
self.context.setMethodAliases({})
- def _initAliases(self, node, mode):
+ def _initAliases(self, node):
aliases = self.context.getMethodAliases()
for child in node.childNodes:
# BBB: for CMF 1.5 profiles
@@ -129,7 +127,7 @@
def _purgeActions(self):
self.context._actions = ()
- def _initActions(self, node, mode):
+ def _initActions(self, node):
for child in node.childNodes:
if child.nodeName != 'action':
continue
@@ -152,7 +150,7 @@
self.context.addAction(id, title, action, condition,
tuple(permissions), category, visible)
- def _initOldstyleProperties(self, node, mode):
+ def _initOldstyleProperties(self, node):
if not node.hasAttribute('title'):
return
# BBB: for CMF 1.5 profiles
@@ -207,10 +205,9 @@
_LOGGER_ID = 'types'
- def exportNode(self, doc):
+ def _exportNode(self):
"""Export the object as a DOM node.
"""
- self._doc = doc
node = self._getObjectNode('object')
node.appendChild(self._extractProperties())
node.appendChild(self._extractObjects())
@@ -218,20 +215,20 @@
self._logger.info('Types tool exported.')
return node
- def importNode(self, node, mode=PURGE):
+ def _importNode(self, node):
"""Import the object from the DOM node.
"""
- if mode == PURGE:
+ if self.environ.shouldPurge():
self._purgeProperties()
self._purgeObjects()
- self._initProperties(node, mode)
- self._initObjects(node, mode)
- self._initBBBObjects(node, mode)
+ self._initProperties(node)
+ self._initObjects(node)
+ self._initBBBObjects(node)
self._logger.info('Types tool imported.')
- def _initBBBObjects(self, node, mode):
+ def _initBBBObjects(self, node):
for child in node.childNodes:
if child.nodeName != 'type':
continue
@@ -242,6 +239,7 @@
filename = str(child.getAttribute('filename'))
if not filename:
filename = 'types/%s.xml' % obj_id.replace(' ', '_')
+ # cheating here for BBB: readDataFile is no interface method
body = self.environ.readDataFile(filename)
if body is None:
break
Modified: CMF/branches/1.6/CMFCore/exportimport/workflow.py
===================================================================
--- CMF/branches/1.6/CMFCore/exportimport/workflow.py 2005-12-12 10:33:40 UTC (rev 40715)
+++ CMF/branches/1.6/CMFCore/exportimport/workflow.py 2005-12-12 11:02:25 UTC (rev 40716)
@@ -19,7 +19,6 @@
from zope.app import zapi
from Products.GenericSetup.interfaces import IBody
-from Products.GenericSetup.interfaces import PURGE
from Products.GenericSetup.utils import exportObjects
from Products.GenericSetup.utils import importObjects
from Products.GenericSetup.utils import ObjectManagerHelpers
@@ -42,10 +41,9 @@
_LOGGER_ID = 'workflow'
- def exportNode(self, doc):
+ def _exportNode(self):
"""Export the object as a DOM node.
"""
- self._doc = doc
node = self._getObjectNode('object')
node.appendChild(self._extractProperties())
node.appendChild(self._extractObjects())
@@ -54,22 +52,22 @@
self._logger.info('Workflow tool exported.')
return node
- def importNode(self, node, mode=PURGE):
+ def _importNode(self, node):
"""Import the object from the DOM node.
"""
- if mode == PURGE:
+ if self.environ.shouldPurge():
self._purgeProperties()
self._purgeObjects()
self._purgeChains()
- self._initProperties(node, mode)
- self._initObjects(node, mode)
- self._initBBBObjects(node, mode)
- self._initChains(node, mode)
+ self._initProperties(node)
+ self._initObjects(node)
+ self._initBBBObjects(node)
+ self._initChains(node)
self._logger.info('Workflow tool imported.')
- def _initBBBObjects(self, node, mode):
+ def _initBBBObjects(self, node):
for child in node.childNodes:
if child.nodeName != 'workflow':
continue
@@ -113,7 +111,7 @@
if self.context._chains_by_type is not None:
self.context._chains_by_type.clear()
- def _initChains(self, node, mode):
+ def _initChains(self, node):
for child in node.childNodes:
if child.nodeName != 'bindings':
continue
Modified: CMF/branches/1.6/DCWorkflow/browser/workflow.py
===================================================================
--- CMF/branches/1.6/DCWorkflow/browser/workflow.py 2005-12-12 10:33:40 UTC (rev 40715)
+++ CMF/branches/1.6/DCWorkflow/browser/workflow.py 2005-12-12 11:02:25 UTC (rev 40716)
@@ -59,7 +59,7 @@
'obj_ids': tuple(obj_ids)})
return tuple(profiles)
- def _initSettings(self, obj, profile_id, obj_id):
+ def _initSettings(self, obj, profile_id, obj_path):
stool = getToolByName(self, 'portal_setup', None)
if stool is None:
return
@@ -73,7 +73,7 @@
continue
root = parseString(body).documentElement
- if not root.getAttribute('workflow_id') == obj_id:
+ if not root.getAttribute('workflow_id') == obj_path[0]:
continue
importer = zapi.queryMultiAdapter((obj, context), IBody)
Modified: CMF/branches/1.6/DCWorkflow/configure.zcml
===================================================================
--- CMF/branches/1.6/DCWorkflow/configure.zcml 2005-12-12 10:33:40 UTC (rev 40715)
+++ CMF/branches/1.6/DCWorkflow/configure.zcml 2005-12-12 11:02:25 UTC (rev 40716)
@@ -17,7 +17,7 @@
factory=".exportimport.DCWorkflowDefinitionBodyAdapter"
provides="Products.GenericSetup.interfaces.IBody"
for=".interfaces.IDCWorkflowDefinition
- Products.GenericSetup.interfaces.ISetupContext"
+ Products.GenericSetup.interfaces.ISetupEnviron"
/>
<five:implements
More information about the CMF-checkins
mailing list