[CMF-checkins] SVN: CMF/branches/1.6/CMF backported r40817:40822
from trunk:
Yvo Schubbe
y.2005- at wcm-solutions.de
Fri Dec 16 14:00:45 EST 2005
Log message for revision 40825:
backported r40817:40822 from trunk:
- renamed typestool.xml to types.xml (it was the only one with 'tool' in the name and didn't match the name of the related folder)
- fixed BBB for CMF 1.5 profiles
- log the object id from the imported XML file, not from the context
Changed:
A CMF/branches/1.6/CMFCalendar/profiles/default/types.xml
D CMF/branches/1.6/CMFCalendar/profiles/default/typestool.xml
U CMF/branches/1.6/CMFCore/browser/typeinfo.py
U CMF/branches/1.6/CMFCore/exportimport/tests/test_typeinfo.py
U CMF/branches/1.6/CMFCore/exportimport/typeinfo.py
A CMF/branches/1.6/CMFDefault/profiles/default/types.xml
D CMF/branches/1.6/CMFDefault/profiles/default/typestool.xml
A CMF/branches/1.6/CMFTopic/profiles/default/types.xml
D CMF/branches/1.6/CMFTopic/profiles/default/typestool.xml
-=-
Copied: CMF/branches/1.6/CMFCalendar/profiles/default/types.xml (from rev 40822, CMF/trunk/CMFCalendar/profiles/default/types.xml)
Deleted: CMF/branches/1.6/CMFCalendar/profiles/default/typestool.xml
===================================================================
--- CMF/branches/1.6/CMFCalendar/profiles/default/typestool.xml 2005-12-16 18:58:49 UTC (rev 40824)
+++ CMF/branches/1.6/CMFCalendar/profiles/default/typestool.xml 2005-12-16 19:00:44 UTC (rev 40825)
@@ -1,4 +0,0 @@
-<?xml version="1.0"?>
-<object name="portal_types" meta_type="CMF Types Tool">
- <object name="Event" meta_type="Factory-based Type Information"/>
-</object>
Modified: CMF/branches/1.6/CMFCore/browser/typeinfo.py
===================================================================
--- CMF/branches/1.6/CMFCore/browser/typeinfo.py 2005-12-16 18:58:49 UTC (rev 40824)
+++ CMF/branches/1.6/CMFCore/browser/typeinfo.py 2005-12-16 19:00:44 UTC (rev 40825)
@@ -49,10 +49,15 @@
if body is None:
continue
root = parseString(body).documentElement
- obj_id = root.getAttribute('name')
+ obj_id = str(root.getAttribute('name'))
if not obj_id:
- obj_id = root.getAttribute('id')
- if root.getAttribute('meta_type') != self.klass.meta_type:
+ # 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'))
+ if meta_type != self.klass.meta_type:
continue
obj_ids.append(obj_id)
if not obj_ids:
@@ -77,13 +82,18 @@
continue
root = parseString(body).documentElement
- new_id = root.getAttribute('name')
+ new_id = str(root.getAttribute('name'))
if not new_id:
- new_id = root.getAttribute('id')
+ # BBB: for CMF 1.5 profiles
+ new_id = str(root.getAttribute('id'))
if new_id != obj_path[0]:
continue
- if root.getAttribute('meta_type') != self.klass.meta_type:
+ # BBB: for CMF 1.5 profiles
+ meta_type = str(root.getAttribute('kind'))
+ if not meta_type:
+ meta_type = str(root.getAttribute('meta_type'))
+ if meta_type != self.klass.meta_type:
continue
importer = zapi.queryMultiAdapter((obj, context), IBody)
Modified: CMF/branches/1.6/CMFCore/exportimport/tests/test_typeinfo.py
===================================================================
--- CMF/branches/1.6/CMFCore/exportimport/tests/test_typeinfo.py 2005-12-16 18:58:49 UTC (rev 40824)
+++ CMF/branches/1.6/CMFCore/exportimport/tests/test_typeinfo.py 2005-12-16 19:00:44 UTC (rev 40825)
@@ -494,7 +494,7 @@
self.assertEqual(len(context._wrote), 1)
filename, text, content_type = context._wrote[0]
- self.assertEqual(filename, 'typestool.xml')
+ self.assertEqual(filename, 'types.xml')
self._compareDOM(text, _EMPTY_TOOL_EXPORT)
self.assertEqual(content_type, 'text/xml')
@@ -507,7 +507,7 @@
self.assertEqual(len(context._wrote), 3)
filename, text, content_type = context._wrote[0]
- self.assertEqual(filename, 'typestool.xml')
+ self.assertEqual(filename, 'types.xml')
self._compareDOM(text, _NORMAL_TOOL_EXPORT)
self.assertEqual(content_type, 'text/xml')
@@ -530,7 +530,7 @@
self.assertEqual(len(context._wrote), 3)
filename, text, content_type = context._wrote[0]
- self.assertEqual(filename, 'typestool.xml')
+ self.assertEqual(filename, 'types.xml')
self._compareDOM(text, _FILENAME_EXPORT)
self.assertEqual(content_type, 'text/xml')
filename, text, content_type = context._wrote[2]
@@ -558,7 +558,7 @@
self.assertEqual(len(tool.objectIds()), 2)
context = DummyImportContext(site)
- context._files['typestool.xml'] = self._EMPTY_TOOL_EXPORT
+ context._files['types.xml'] = self._EMPTY_TOOL_EXPORT
importTypesTool(context)
self.assertEqual(len(tool.objectIds()), 0)
@@ -572,7 +572,7 @@
self.assertEqual(len(tool.objectIds()), 2)
context = DummyImportContext(site, True)
- context._files['typestool.xml'] = self._EMPTY_TOOL_EXPORT
+ context._files['types.xml'] = self._EMPTY_TOOL_EXPORT
importTypesTool(context)
self.assertEqual(len(tool.objectIds()), 0)
@@ -586,7 +586,7 @@
self.assertEqual(len(tool.objectIds()), 2)
context = DummyImportContext(site, False)
- context._files['typestool.xml'] = self._EMPTY_TOOL_EXPORT
+ context._files['types.xml'] = self._EMPTY_TOOL_EXPORT
importTypesTool(context)
self.assertEqual(len(tool.objectIds()), 2)
@@ -600,7 +600,7 @@
self.assertEqual(len(tool.objectIds()), 0)
context = DummyImportContext(site)
- context._files['typestool.xml'] = self._NORMAL_TOOL_EXPORT
+ context._files['types.xml'] = self._NORMAL_TOOL_EXPORT
context._files['types/foo.xml'] = _FOO_EXPORT % 'foo'
context._files['types/bar.xml'] = _BAR_EXPORT % 'bar'
importTypesTool(context)
@@ -619,7 +619,7 @@
self.assertEqual(len(tool.objectIds()), 0)
context = DummyImportContext(site)
- context._files['typestool.xml'] = self._NORMAL_TOOL_EXPORT
+ 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)
@@ -645,7 +645,7 @@
self.assertEqual(len(tool.objectIds()), 0)
context = DummyImportContext(site)
- context._files['typestool.xml'] = self._FILENAME_EXPORT
+ context._files['types.xml'] = self._FILENAME_EXPORT
context._files['types/foo_object.xml'] = _FOO_EXPORT % 'foo object'
context._files['types/bar_object.xml'] = _BAR_EXPORT % 'bar object'
importTypesTool(context)
@@ -661,7 +661,7 @@
tool = site.portal_types
context = DummyImportContext(site)
- context._files['typestool.xml'] = self._NORMAL_TOOL_EXPORT
+ context._files['types.xml'] = self._NORMAL_TOOL_EXPORT
context._files['types/foo.xml'] = _FOO_EXPORT % 'foo'
context._files['types/bar.xml'] = _BAR_EXPORT % 'bar'
importTypesTool(context)
@@ -674,7 +674,7 @@
{'(Default)': 'foo_view', 'view': 'foo_view'})
context = DummyImportContext(site, False)
- context._files['typestool.xml'] = _UPDATE_TOOL_IMPORT
+ context._files['types.xml'] = _UPDATE_TOOL_IMPORT
context._files['types/foo.xml'] = _UPDATE_FOO_IMPORT
importTypesTool(context)
Modified: CMF/branches/1.6/CMFCore/exportimport/typeinfo.py
===================================================================
--- CMF/branches/1.6/CMFCore/exportimport/typeinfo.py 2005-12-16 18:58:49 UTC (rev 40824)
+++ CMF/branches/1.6/CMFCore/exportimport/typeinfo.py 2005-12-16 19:00:44 UTC (rev 40825)
@@ -32,7 +32,7 @@
from Products.CMFCore.interfaces import ITypesTool
from Products.CMFCore.utils import getToolByName
-_FILENAME = 'typestool.xml'
+_FILENAME = 'types.xml'
class TypeInformationXMLAdapter(XMLAdapterBase, PropertyManagerHelpers):
@@ -69,7 +69,11 @@
self._initAliases(node)
self._initActions(node)
- self._logger.info('%r type info imported.' % self.context.getId())
+ 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):
fragment = self._doc.createDocumentFragment()
@@ -265,8 +269,10 @@
body = context.readDataFile(_FILENAME)
if body is None:
- logger.info('Nothing to import.')
- return
+ body = context.readDataFile('typestool.xml')
+ if body is None:
+ logger.info('Nothing to import.')
+ return
importer = zapi.queryMultiAdapter((tool, context), IBody)
if importer is None:
Copied: CMF/branches/1.6/CMFDefault/profiles/default/types.xml (from rev 40822, CMF/trunk/CMFDefault/profiles/default/types.xml)
Deleted: CMF/branches/1.6/CMFDefault/profiles/default/typestool.xml
===================================================================
--- CMF/branches/1.6/CMFDefault/profiles/default/typestool.xml 2005-12-16 18:58:49 UTC (rev 40824)
+++ CMF/branches/1.6/CMFDefault/profiles/default/typestool.xml 2005-12-16 19:00:44 UTC (rev 40825)
@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-<object name="portal_types" meta_type="CMF Types Tool">
- <property name="title"></property>
- <object name="CMF BTree Folder" meta_type="Factory-based Type Information"/>
- <object name="Discussion Item" meta_type="Factory-based Type Information"/>
- <object name="Document" meta_type="Factory-based Type Information"/>
- <object name="Favorite" meta_type="Factory-based Type Information"/>
- <object name="File" meta_type="Factory-based Type Information"/>
- <object name="Folder" meta_type="Factory-based Type Information"/>
- <object name="Image" meta_type="Factory-based Type Information"/>
- <object name="Link" meta_type="Factory-based Type Information"/>
- <object name="News Item" meta_type="Factory-based Type Information"/>
-</object>
Copied: CMF/branches/1.6/CMFTopic/profiles/default/types.xml (from rev 40822, CMF/trunk/CMFTopic/profiles/default/types.xml)
Deleted: CMF/branches/1.6/CMFTopic/profiles/default/typestool.xml
===================================================================
--- CMF/branches/1.6/CMFTopic/profiles/default/typestool.xml 2005-12-16 18:58:49 UTC (rev 40824)
+++ CMF/branches/1.6/CMFTopic/profiles/default/typestool.xml 2005-12-16 19:00:44 UTC (rev 40825)
@@ -1,4 +0,0 @@
-<?xml version="1.0"?>
-<object name="portal_types" meta_type="CMF Types Tool">
- <object name="Topic" meta_type="Factory-based Type Information"/>
-</object>
More information about the CMF-checkins
mailing list