[Checkins] SVN: CMF/trunk/C - removed BBB code for CMFSetup profiles

Yvo Schubbe y.2006_ at wcm-solutions.de
Mon Apr 24 14:58:08 EDT 2006


Log message for revision 67577:
  - removed BBB code for CMFSetup profiles

Changed:
  U   CMF/trunk/CHANGES.txt
  U   CMF/trunk/CMFCore/browser/typeinfo.py
  U   CMF/trunk/CMFCore/exportimport/actions.py
  U   CMF/trunk/CMFCore/exportimport/cachingpolicymgr.py
  U   CMF/trunk/CMFCore/exportimport/contenttyperegistry.py
  U   CMF/trunk/CMFCore/exportimport/skins.py
  U   CMF/trunk/CMFCore/exportimport/tests/test_actions.py
  U   CMF/trunk/CMFCore/exportimport/tests/test_skins.py
  U   CMF/trunk/CMFCore/exportimport/tests/test_typeinfo.py
  U   CMF/trunk/CMFCore/exportimport/tests/test_workflow.py
  U   CMF/trunk/CMFCore/exportimport/typeinfo.py
  U   CMF/trunk/CMFCore/exportimport/workflow.py

-=-
Modified: CMF/trunk/CHANGES.txt
===================================================================
--- CMF/trunk/CHANGES.txt	2006-04-24 18:45:58 UTC (rev 67576)
+++ CMF/trunk/CHANGES.txt	2006-04-24 18:58:07 UTC (rev 67577)
@@ -10,7 +10,7 @@
 
   Others
 
-    -
+    - setup handlers: Removed support for CMF 1.5 CMFSetup profiles.
 
 CMF 2.0.x
 

Modified: CMF/trunk/CMFCore/browser/typeinfo.py
===================================================================
--- CMF/trunk/CMFCore/browser/typeinfo.py	2006-04-24 18:45:58 UTC (rev 67576)
+++ CMF/trunk/CMFCore/browser/typeinfo.py	2006-04-24 18:58:07 UTC (rev 67577)
@@ -48,17 +48,13 @@
                     body = context.readDataFile(filename)
                     if body is None:
                         continue
+
                     root = parseString(body).documentElement
-                    obj_id = str(root.getAttribute('name'))
-                    if not obj_id:
-                        # BBB: for CMF 1.5 profiles
-                        obj_id = str(root.getAttribute('id'))
-                    # BBB: for CMF 1.5 profiles
-                    meta_type = str(root.getAttribute('kind'))
-                    if not meta_type:
-                        meta_type = str(root.getAttribute('meta_type'))
+                    meta_type = str(root.getAttribute('meta_type'))
                     if meta_type != self.klass.meta_type:
                         continue
+
+                    obj_id = str(root.getAttribute('name'))
                     obj_ids.append(obj_id)
                 if not obj_ids:
                     continue
@@ -83,16 +79,10 @@
 
             root = parseString(body).documentElement
             new_id = str(root.getAttribute('name'))
-            if not new_id:
-                # BBB: for CMF 1.5 profiles
-                new_id = str(root.getAttribute('id'))
             if new_id != obj_path[0]:
                 continue
 
-            # BBB: for CMF 1.5 profiles
-            meta_type = str(root.getAttribute('kind'))
-            if not meta_type:
-                meta_type = str(root.getAttribute('meta_type'))
+            meta_type = str(root.getAttribute('meta_type'))
             if meta_type != self.klass.meta_type:
                 continue
 

Modified: CMF/trunk/CMFCore/exportimport/actions.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/actions.py	2006-04-24 18:45:58 UTC (rev 67576)
+++ CMF/trunk/CMFCore/exportimport/actions.py	2006-04-24 18:58:07 UTC (rev 67577)
@@ -136,14 +136,14 @@
         for provider_id in self.context.listActionProviders():
             child = self._doc.createElement('action-provider')
             child.setAttribute('name', provider_id)
-            # BBB: for CMF 1.5 profiles
+            # BBB: for CMF 1.6 profiles
             sub = self._extractOldstyleActions(provider_id)
             child.appendChild(sub)
             fragment.appendChild(child)
         return fragment
 
     def _extractOldstyleActions(self, provider_id):
-        # BBB: for CMF 1.5 profiles
+        # BBB: for CMF 1.6 profiles
         fragment = self._doc.createDocumentFragment()
 
         provider = getToolByName(self.context, provider_id)
@@ -185,9 +185,6 @@
                 continue
 
             provider_id = str(child.getAttribute('name'))
-            if not provider_id:
-                # BBB: for CMF 1.5 profiles
-                provider_id = str(child.getAttribute('id'))
             if child.hasAttribute('remove'):
                 if provider_id in self.context.listActionProviders():
                     self.context.deleteActionProvider(provider_id)
@@ -197,11 +194,11 @@
                     provider_id not in self.context.listActionProviders():
                 self.context.addActionProvider(provider_id)
 
-            # BBB: for CMF 1.5 profiles
+            # BBB: for CMF 1.6 profiles
             self._initOldstyleActions(child)
 
     def _initOldstyleActions(self, node):
-        # BBB: for CMF 1.5 profiles
+        # BBB: for CMF 1.6 profiles
         doc = node.ownerDocument
         fragment = doc.createDocumentFragment()
         for child in node.childNodes:

Modified: CMF/trunk/CMFCore/exportimport/cachingpolicymgr.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/cachingpolicymgr.py	2006-04-24 18:45:58 UTC (rev 67576)
+++ CMF/trunk/CMFCore/exportimport/cachingpolicymgr.py	2006-04-24 18:58:07 UTC (rev 67577)
@@ -75,9 +75,6 @@
         """
         info = {}
         policy_id = node.getAttribute('name')
-        if not policy_id:
-            # BBB: for CMF 1.5 profiles
-            policy_id = node.getAttribute('policy_id')
         info['policy_id'] = str(policy_id)
         info['predicate'] = str(node.getAttribute('predicate'))
         info['mtime_func'] = str(node.getAttribute('mtime_func'))

Modified: CMF/trunk/CMFCore/exportimport/contenttyperegistry.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/contenttyperegistry.py	2006-04-24 18:45:58 UTC (rev 67576)
+++ CMF/trunk/CMFCore/exportimport/contenttyperegistry.py	2006-04-24 18:58:07 UTC (rev 67577)
@@ -80,9 +80,6 @@
             parent = self.context
 
             predicate_id = str(child.getAttribute('name'))
-            if not predicate_id:
-                # BBB: for CMF 1.5 profiles
-                predicate_id = str(child.getAttribute('predicate_id'))
             predicate_type = str(child.getAttribute('predicate_type'))
             content_type_name = str(child.getAttribute('content_type_name'))
             if predicate_id not in parent.predicate_ids:

Modified: CMF/trunk/CMFCore/exportimport/skins.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/skins.py	2006-04-24 18:45:58 UTC (rev 67576)
+++ CMF/trunk/CMFCore/exportimport/skins.py	2006-04-24 18:58:07 UTC (rev 67577)
@@ -104,22 +104,10 @@
             persistence = node.getAttribute('cookie_persistence')
             obj.cookie_persistence = int(self._convertToBoolean(persistence))
         self._initObjects(node)
-        self._initBBBObjects(node)
         self._initSkinPaths(node)
 
         self._logger.info('Skins tool imported.')
 
-    def _initBBBObjects(self, node):
-        for child in node.childNodes:
-            if child.nodeName != 'skin-directory':
-                continue
-            parent = self.context
-
-            obj_id = str(child.getAttribute('id'))
-            obj_dir = str(child.getAttribute('directory'))
-            if obj_id not in parent.objectIds():
-                createDirectoryView(self.context, obj_dir, obj_id)
-
     def _extractSkinPaths(self):
         fragment = self._doc.createDocumentFragment()
         for k, v in self.context.getSkinPaths():
@@ -140,9 +128,6 @@
             if child.nodeName != 'skin-path':
                 continue
             path_id = str(child.getAttribute('name'))
-            if not path_id:
-                #BBB
-                path_id = str(child.getAttribute('id'))
             if path_id == '*':
                 for path_id, path in self.context._getSelections().items():
                     path = self._updatePath(path, child)

Modified: CMF/trunk/CMFCore/exportimport/tests/test_actions.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_actions.py	2006-04-24 18:45:58 UTC (rev 67576)
+++ CMF/trunk/CMFCore/exportimport/tests/test_actions.py	2006-04-24 18:58:07 UTC (rev 67577)
@@ -87,16 +87,16 @@
 
 _EMPTY_EXPORT = """\
 <?xml version="1.0"?>
-<object meta_type="CMF Actions Tool" name="portal_actions" \
-xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+<object name="portal_actions" meta_type="CMF Actions Tool"
+   xmlns:i18n="http://xml.zope.org/namespaces/i18n">
  <action-provider name="portal_actions"/>
 </object>
 """
 
 _NORMAL_EXPORT = """\
 <?xml version="1.0"?>
-<object meta_type="CMF Actions Tool" name="portal_actions" \
-xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+<object name="portal_actions" meta_type="CMF Actions Tool"
+   xmlns:i18n="http://xml.zope.org/namespaces/i18n">
  <action-provider name="portal_actions"/>
  <action-provider name="portal_foo">
   <action action_id="foo"
@@ -121,8 +121,8 @@
 
 _NEWSYTLE_EXPORT = """\
 <?xml version="1.0"?>
-<object meta_type="CMF Actions Tool" name="portal_actions" \
-xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+<object name="portal_actions" meta_type="CMF Actions Tool"
+   xmlns:i18n="http://xml.zope.org/namespaces/i18n">
  <action-provider name="portal_actions"/>
  <object name="dummy" meta_type="CMF Action Category">
   <property name="title"></property>
@@ -152,8 +152,8 @@
 
 _I18N_IMPORT = """\
 <?xml version="1.0"?>
-<object meta_type="CMF Actions Tool" name="portal_actions" \
-xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+<object name="portal_actions" meta_type="CMF Actions Tool"
+   xmlns:i18n="http://xml.zope.org/namespaces/i18n">
  <action-provider name="portal_actions"/>
  <object name="dummy" meta_type="CMF Action Category">
   <property name="title"></property>
@@ -172,7 +172,7 @@
 
 _INSERT_IMPORT = """\
 <?xml version="1.0"?>
-<actions-tool xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+<object name="portal_actions">
  <object name="dummy">
  <object name="spam" meta_type="CMF Action" insert-before="*">
   <property name="title">Spam</property>
@@ -188,19 +188,16 @@
   <property name="icon_expr">string:foo_icon.png</property>
  </object>
  </object>
-</actions-tool>
+</object>
 """
 
 _REMOVE_IMPORT = """\
 <?xml version="1.0"?>
-<actions-tool xmlns:i18n="http://xml.zope.org/namespaces/i18n">
- <action-provider id="portal_actions" remove="">
- </action-provider>
- <action-provider id="not_existing" remove="">
- </action-provider>
- <action-provider id="portal_bar" remove="">
- </action-provider>
-</actions-tool>
+<object name="portal_actions">
+ <action-provider name="portal_actions" remove=""/>
+ <action-provider name="not_existing" remove=""/>
+ <action-provider name="portal_bar" remove=""/>
+</object>
 """
 
 

Modified: CMF/trunk/CMFCore/exportimport/tests/test_skins.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_skins.py	2006-04-24 18:45:58 UTC (rev 67576)
+++ CMF/trunk/CMFCore/exportimport/tests/test_skins.py	2006-04-24 18:58:07 UTC (rev 67577)
@@ -129,77 +129,7 @@
 </object>
 """
 
-_EMPTY_EXPORT_V1 = """\
-<?xml version="1.0"?>
-<skins-tool default_skin="default_skin"
-            request_varname="request_varname"
-            allow_any="False"
-            cookie_persistence="False">
-</skins-tool>
-"""
 
-_NORMAL_EXPORT_V1 = """\
-<?xml version="1.0"?>
-<skins-tool default_skin="basic"
-            request_varname="skin_var"
-            allow_any="True"
-            cookie_persistence="True">
- <skin-directory id="one" directory="CMFCore/exportimport/tests/one" />
- <skin-directory id="three" directory="CMFCore/exportimport/tests/three" />
- <skin-directory id="two" directory="CMFCore/exportimport/tests/two" />
- <skin-path id="basic">
-  <layer name="one" />
- </skin-path>
- <skin-path id="fancy">
-  <layer name="three" />
-  <layer name="two" />
-  <layer name="one" />
- </skin-path>
-</skins-tool>
-"""
-
-_FRAGMENT1_IMPORT_V1 = """\
-<?xml version="1.0"?>
-<skins-tool>
- <skin-directory id="three" directory="CMFCore/exportimport/tests/three" />
- <skin-path id="*">
-  <layer name="three" insert-before="two"/>
- </skin-path>
-</skins-tool>
-"""
-
-_FRAGMENT2_IMPORT_V1 = """\
-<?xml version="1.0"?>
-<skins-tool>
- <skin-directory id="four" directory="CMFCore/exportimport/tests/four" />
- <skin-path id="*">
-  <layer name="four" insert-after="three"/>
- </skin-path>
-</skins-tool>
-"""
-
-_FRAGMENT3_IMPORT_V1 = """\
-<?xml version="1.0"?>
-<skins-tool>
- <skin-directory id="three" directory="CMFCore/exportimport/tests/three" />
- <skin-directory id="four" directory="CMFCore/exportimport/tests/four" />
- <skin-path id="*">
-  <layer name="three" insert-before="*"/>
-  <layer name="four" insert-after="*"/>
- </skin-path>
-</skins-tool>
-"""
-
-_FRAGMENT4_IMPORT_V1 = """\
-<?xml version="1.0"?>
-<skins-tool>
- <skin-path id="*">
-  <layer name="three" remove="1"/>
- </skin-path>
-</skins-tool>
-"""
-
-
 class DummySite(Folder):
 
     _skin_setup_called = False
@@ -607,23 +537,12 @@
         self.assertEqual(len(skins_tool.objectItems()), 4)
 
 
-class importSkinsToolV1Tests(importSkinsToolTests):
-
-    _EMPTY_EXPORT = _EMPTY_EXPORT
-    _FRAGMENT1_IMPORT = _FRAGMENT1_IMPORT_V1
-    _FRAGMENT2_IMPORT = _FRAGMENT2_IMPORT_V1
-    _FRAGMENT3_IMPORT = _FRAGMENT3_IMPORT_V1
-    _FRAGMENT4_IMPORT = _FRAGMENT4_IMPORT_V1
-    _NORMAL_EXPORT = _NORMAL_EXPORT
-
-
 def test_suite():
     return unittest.TestSuite((
         unittest.makeSuite(DirectoryViewAdapterTests),
         unittest.makeSuite(SkinsToolXMLAdapterTests),
         unittest.makeSuite(exportSkinsToolTests),
         unittest.makeSuite(importSkinsToolTests),
-        unittest.makeSuite(importSkinsToolV1Tests),
         ))
 
 if __name__ == '__main__':

Modified: CMF/trunk/CMFCore/exportimport/tests/test_typeinfo.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_typeinfo.py	2006-04-24 18:45:58 UTC (rev 67576)
+++ CMF/trunk/CMFCore/exportimport/tests/test_typeinfo.py	2006-04-24 18:58:07 UTC (rev 67577)
@@ -152,12 +152,6 @@
 </object>
 """
 
-_EMPTY_TOOL_EXPORT_V1 = """\
-<?xml version="1.0"?>
-<types-tool>
-</types-tool>
-"""
-
 _NORMAL_TOOL_EXPORT = """\
 <?xml version="1.0"?>
 <object name="portal_types" meta_type="CMF Types Tool">
@@ -167,14 +161,6 @@
 </object>
 """
 
-_NORMAL_TOOL_EXPORT_V1 = """\
-<?xml version="1.0"?>
-<types-tool>
- <type id="bar" />
- <type id="foo" />
-</types-tool>
-"""
-
 _FILENAME_EXPORT = """\
 <?xml version="1.0"?>
 <object name="portal_types" meta_type="CMF Types Tool">
@@ -184,14 +170,6 @@
 </object>
 """
 
-_FILENAME_EXPORT_V1 = """\
-<?xml version="1.0"?>
-<types-tool>
- <type id="bar object" filename="types/bar_object.xml" />
- <type id="foo object" filename="types/foo_object.xml" />
-</types-tool>
-"""
-
 _UPDATE_TOOL_IMPORT = """\
 <?xml version="1.0"?>
 <types-tool>
@@ -199,55 +177,6 @@
 </types-tool>
 """
 
-_FOO_OLD_EXPORT = """\
-<?xml version="1.0"?>
-<type-info
-   id="%s"
-   kind="Factory-based Type Information"
-   title="Foo"
-   meta_type="Foo Thing"
-   icon="foo.png"
-   product="CMFSetup"
-   factory="addFoo"
-   immediate_view="foo_view"
-   filter_content_types="False"
-   allow_discussion="False"
-   global_allow="False" >
-  <description>Foo things</description>
-  <aliases>
-   <alias from="(Default)" to="foo_view" />
-   <alias from="view" to="foo_view" />
-  </aliases>
-  <action
-     action_id="view"
-     title="View"
-     url_expr="string:${object_url}/foo_view"
-     condition_expr=""
-     category="object"
-     visible="True">
-   <permission>View</permission>
-  </action>
-  <action
-     action_id="edit"
-     title="Edit"
-     url_expr="string:${object_url}/foo_edit_form"
-     condition_expr=""
-     category="object"
-     visible="True">
-   <permission>Modify portal content</permission>
-  </action>
-  <action
-     action_id="metadata"
-     title="Metadata"
-     url_expr="string:${object_url}/metadata_edit_form"
-     condition_expr=""
-     category="object"
-     visible="True">
-   <permission>Modify portal content</permission>
-  </action>
-</type-info>
-"""
-
 _FOO_EXPORT = """\
 <?xml version="1.0"?>
 <object name="%s" meta_type="Factory-based Type Information"
@@ -281,65 +210,6 @@
 </object>
 """
 
-_BAR_OLD_EXPORT = """\
-<?xml version="1.0"?>
-<type-info
-   id="%s"
-   kind="Scriptable Type Information"
-   title="Bar"
-   meta_type="Bar Thing"
-   icon="bar.png"
-   constructor_path="make_bar"
-   permission="Add portal content"
-   immediate_view="bar_view"
-   filter_content_types="True"
-   allow_discussion="True"
-   global_allow="True" >
-  <description>Bar things</description>
-  <allowed_content_type>foo</allowed_content_type>
-  <aliases>
-   <alias from="(Default)" to="bar_view" />
-   <alias from="view" to="bar_view" />
-  </aliases>
-  <action
-     action_id="view"
-     title="View"
-     url_expr="string:${object_url}/bar_view"
-     condition_expr=""
-     category="object"
-     visible="True">
-   <permission>View</permission>
-  </action>
-  <action
-     action_id="edit"
-     title="Edit"
-     url_expr="string:${object_url}/bar_edit_form"
-     condition_expr=""
-     category="object"
-     visible="True">
-   <permission>Modify portal content</permission>
-  </action>
-  <action
-     action_id="contents"
-     title="Contents"
-     url_expr="string:${object_url}/folder_contents"
-     condition_expr=""
-     category="object"
-     visible="True">
-   <permission>Access contents information</permission>
-  </action>
-  <action
-     action_id="metadata"
-     title="Metadata"
-     url_expr="string:${object_url}/metadata_edit_form"
-     condition_expr=""
-     category="object"
-     visible="True">
-   <permission>Modify portal content</permission>
-  </action>
-</type-info>
-"""
-
 _BAR_EXPORT = """\
 <?xml version="1.0"?>
 <object name="%s" meta_type="Scriptable Type Information"
@@ -609,33 +479,6 @@
         self.failUnless('foo' in tool.objectIds())
         self.failUnless('bar' in tool.objectIds())
 
-    def test_old_xml(self):
-        from Products.CMFCore.exportimport.typeinfo import exportTypesTool
-        from Products.CMFCore.exportimport.typeinfo import importTypesTool
-
-        site = self._initSite()
-        tool = site.portal_types
-
-        self.assertEqual(len(tool.objectIds()), 0)
-
-        context = DummyImportContext(site)
-        context._files['types.xml'] = self._NORMAL_TOOL_EXPORT
-        context._files['types/foo.xml'] = _FOO_OLD_EXPORT % 'foo'
-        context._files['types/bar.xml'] = _BAR_OLD_EXPORT % 'bar'
-        importTypesTool(context)
-
-        self.assertEqual(len(tool.objectIds()), 2)
-        self.failUnless('foo' in tool.objectIds())
-        self.failUnless('bar' in tool.objectIds())
-
-        context = DummyExportContext(site)
-        exportTypesTool(context)
-
-        filename, text, content_type = context._wrote[1]
-        self.assertEqual(filename, 'types/bar.xml')
-        self._compareDOM(text, _BAR_EXPORT % 'bar')
-        self.assertEqual(content_type, 'text/xml')
-
     def test_with_filenames(self):
         from Products.CMFCore.exportimport.typeinfo import importTypesTool
 
@@ -685,20 +528,13 @@
         self.assertEqual(tool.foo._aliases,
                {'(Default)': 'foo_view', 'view': 'foo_view', 'spam': 'eggs'})
 
-class importTypesToolV1Tests(importTypesToolTests):
 
-    _EMPTY_TOOL_EXPORT = _EMPTY_TOOL_EXPORT_V1
-    _FILENAME_EXPORT = _FILENAME_EXPORT_V1
-    _NORMAL_TOOL_EXPORT = _NORMAL_TOOL_EXPORT_V1
-
-
 def test_suite():
     return unittest.TestSuite((
         unittest.makeSuite(TypeInformationXMLAdapterTests),
         unittest.makeSuite(TypesToolXMLAdapterTests),
         unittest.makeSuite(exportTypesToolTests),
         unittest.makeSuite(importTypesToolTests),
-        unittest.makeSuite(importTypesToolV1Tests),
         ))
 
 if __name__ == '__main__':

Modified: CMF/trunk/CMFCore/exportimport/tests/test_workflow.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/tests/test_workflow.py	2006-04-24 18:45:58 UTC (rev 67576)
+++ CMF/trunk/CMFCore/exportimport/tests/test_workflow.py	2006-04-24 18:58:07 UTC (rev 67577)
@@ -109,35 +109,7 @@
 </object>
 """
 
-_EMPTY_TOOL_EXPORT_V1 = """\
-<?xml version="1.0"?>
-<workflow-tool>
- <bindings>
-  <default>
-  </default>
- </bindings>
-</workflow-tool>
-"""
 
-_BINDINGS_TOOL_EXPORT_V1 = """\
-<?xml version="1.0"?>
-<workflow-tool>
- <bindings>
-  <default>
-   <bound-workflow workflow_id="non_dcworkflow_0" />
-   <bound-workflow workflow_id="non_dcworkflow_1" />
-  </default>
-  <type type_id="sometype">
-   <bound-workflow workflow_id="non_dcworkflow_2" />
-  </type>
-  <type type_id="anothertype">
-   <bound-workflow workflow_id="non_dcworkflow_3" />
-  </type>
- </bindings>
-</workflow-tool>
-"""
-
-
 class DummyWorkflowTool(Folder):
 
     implements(IWorkflowTool)
@@ -388,18 +360,11 @@
                          (WF_ID_NON % 3,))
 
 
-class importWorkflowToolV1Tests(importWorkflowToolTests):
-
-    _BINDINGS_TOOL_EXPORT = _BINDINGS_TOOL_EXPORT_V1
-    _EMPTY_TOOL_EXPORT = _EMPTY_TOOL_EXPORT_V1
-
-
 def test_suite():
     return unittest.TestSuite((
         unittest.makeSuite(WorkflowToolXMLAdapterTests),
         unittest.makeSuite(exportWorkflowToolTests),
         unittest.makeSuite(importWorkflowToolTests),
-        unittest.makeSuite(importWorkflowToolV1Tests),
         ))
 
 if __name__ == '__main__':

Modified: CMF/trunk/CMFCore/exportimport/typeinfo.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/typeinfo.py	2006-04-24 18:45:58 UTC (rev 67576)
+++ CMF/trunk/CMFCore/exportimport/typeinfo.py	2006-04-24 18:58:07 UTC (rev 67577)
@@ -62,15 +62,11 @@
             self._purgeAliases()
             self._purgeActions()
 
-        self._initOldstyleProperties(node)
         self._initProperties(node)
         self._initAliases(node)
         self._initActions(node)
 
         obj_id = str(node.getAttribute('name'))
-        if not obj_id:
-            # BBB: for CMF 1.5 profiles
-            obj_id = str(node.getAttribute('id'))
         self._logger.info('%r type info imported.' % obj_id)
 
     def _extractAliases(self):
@@ -90,16 +86,6 @@
     def _initAliases(self, node):
         aliases = self.context.getMethodAliases()
         for child in node.childNodes:
-            # BBB: for CMF 1.5 profiles
-            #      'alias' nodes moved one level up.
-            if child.nodeName == 'aliases':
-                for sub in child.childNodes:
-                    if sub.nodeName != 'alias':
-                        continue
-                    k = str(sub.getAttribute('from'))
-                    v = str(sub.getAttribute('to'))
-                    aliases[k] = v
-
             if child.nodeName != 'alias':
                 continue
             k = str(child.getAttribute('from'))
@@ -144,10 +130,6 @@
                 if sub.nodeName != 'permission':
                     continue
                 permission = sub.getAttribute('value')
-                # BBB: for CMF 1.5 profiles
-                #      Permission name moved from node text to 'value'.
-                if not permission:
-                    permission = self._getNodeText(sub)
                 permissions.append(permission)
             action_obj = self.context.getActionObject(category+'/'+id)
             if action_obj is None:
@@ -159,51 +141,7 @@
                                 permissions=tuple(permissions),
                                 visible=visible)
 
-    def _initOldstyleProperties(self, node):
-        if not node.hasAttribute('title'):
-            return
-        # BBB: for CMF 1.5 profiles
-        obj = self.context
 
-        title = node.getAttribute('title')
-        description = ''
-        content_meta_type = node.getAttribute('meta_type')
-        content_icon = node.getAttribute('icon')
-        immediate_view = node.getAttribute('immediate_view')
-        global_allow = self._convertToBoolean(node.getAttribute(
-                                                              'global_allow'))
-        filter_content_types = self._convertToBoolean(node.getAttribute(
-                                                      'filter_content_types'))
-        allowed_content_types = []
-        allow_discussion = self._convertToBoolean(node.getAttribute(
-                                                          'allow_discussion'))
-        for child in node.childNodes:
-            if child.nodeName == 'description':
-                description += self._getNodeText(child)
-            elif child.nodeName == 'allowed_content_type':
-                allowed_content_types.append(self._getNodeText(child))
-        obj._updateProperty('title', title)
-        obj._updateProperty('description', description)
-        obj._updateProperty('content_meta_type', content_meta_type)
-        obj._updateProperty('content_icon', content_icon)
-        obj._updateProperty('immediate_view', immediate_view)
-        obj._updateProperty('global_allow', global_allow)
-        obj._updateProperty('filter_content_types', filter_content_types)
-        obj._updateProperty('allowed_content_types', allowed_content_types)
-        obj._updateProperty('allow_discussion', allow_discussion)
-
-        if node.getAttribute('kind') == 'Factory-based Type Information':
-            product = node.getAttribute('product')
-            factory = node.getAttribute('factory')
-            obj._updateProperty('product', product)
-            obj._updateProperty('factory', factory)
-        else:
-            constructor_path = node.getAttribute('constructor_path')
-            permission = node.getAttribute('permission')
-            obj._updateProperty('constructor_path', constructor_path)
-            obj._updateProperty('permission', permission)
-
-
 class TypesToolXMLAdapter(XMLAdapterBase, ObjectManagerHelpers,
                           PropertyManagerHelpers):
 
@@ -235,38 +173,10 @@
 
         self._initProperties(node)
         self._initObjects(node)
-        self._initBBBObjects(node)
 
         self._logger.info('Types tool imported.')
 
-    def _initBBBObjects(self, node):
-        for child in node.childNodes:
-            if child.nodeName != 'type':
-                continue
-            parent = self.context
 
-            obj_id = str(child.getAttribute('id'))
-            if obj_id not in parent.objectIds():
-                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
-                root = parseString(body).documentElement
-                if root.getAttribute('name') != obj_id:
-                    if root.getAttribute('id') != obj_id:
-                        break
-                meta_type = str(root.getAttribute('kind'))
-                if not meta_type:
-                    meta_type = str(root.getAttribute('meta_type'))
-                for mt_info in Products.meta_types:
-                    if mt_info['name'] == meta_type:
-                        parent._setObject(obj_id, mt_info['instance'](obj_id))
-                        break
-
-
 def importTypesTool(context):
     """Import types tool and content types from XML files.
     """

Modified: CMF/trunk/CMFCore/exportimport/workflow.py
===================================================================
--- CMF/trunk/CMFCore/exportimport/workflow.py	2006-04-24 18:45:58 UTC (rev 67576)
+++ CMF/trunk/CMFCore/exportimport/workflow.py	2006-04-24 18:58:07 UTC (rev 67577)
@@ -62,25 +62,10 @@
 
         self._initProperties(node)
         self._initObjects(node)
-        self._initBBBObjects(node)
         self._initChains(node)
 
         self._logger.info('Workflow tool imported.')
 
-    def _initBBBObjects(self, node):
-        for child in node.childNodes:
-            if child.nodeName != 'workflow':
-                continue
-            parent = self.context
-
-            obj_id = str(child.getAttribute('workflow_id'))
-            if obj_id not in parent.objectIds():
-                meta_type = str(child.getAttribute('meta_type'))
-                for mt_info in Products.meta_types:
-                    if mt_info['name'] == meta_type:
-                        parent._setObject(obj_id, mt_info['instance'](obj_id))
-                        break
-
     def _extractChains(self):
         fragment = self._doc.createDocumentFragment()
         node = self._doc.createElement('bindings')



More information about the Checkins mailing list