[Checkins] SVN: Products.GenericSetup/branches/1.4/Products/GenericSetup/ Don't fail when a sub-item cannot be adapted after creation when importing a folder.
Tres Seaver
tseaver at palladion.com
Thu Nov 20 13:17:59 EST 2008
Log message for revision 93186:
Don't fail when a sub-item cannot be adapted after creation when importing a folder.
o https://bugs.launchpad.net/zope-cmf/+bug/300315
Changed:
U Products.GenericSetup/branches/1.4/Products/GenericSetup/CHANGES.txt
U Products.GenericSetup/branches/1.4/Products/GenericSetup/content.py
U Products.GenericSetup/branches/1.4/Products/GenericSetup/tests/test_content.py
U Products.GenericSetup/branches/1.4/Products/GenericSetup/version.txt
-=-
Modified: Products.GenericSetup/branches/1.4/Products/GenericSetup/CHANGES.txt
===================================================================
--- Products.GenericSetup/branches/1.4/Products/GenericSetup/CHANGES.txt 2008-11-20 18:12:29 UTC (rev 93185)
+++ Products.GenericSetup/branches/1.4/Products/GenericSetup/CHANGES.txt 2008-11-20 18:17:58 UTC (rev 93186)
@@ -4,6 +4,9 @@
GenericSetup 1.4.3 (unreleased)
-------------------------------
+- Don't fail when a sub-item cannot be adapted after creation when
+ importing a folder. (https://bugs.launchpad.net/zope-cmf/+bug/300315)
+
- Avoid even an explicit purge of the rolemap if no XML file is present
in a given context. (https://bugs.launchpad.net/zope-cmf/+bug/279294)
Modified: Products.GenericSetup/branches/1.4/Products/GenericSetup/content.py
===================================================================
--- Products.GenericSetup/branches/1.4/Products/GenericSetup/content.py 2008-11-20 18:12:29 UTC (rev 93185)
+++ Products.GenericSetup/branches/1.4/Products/GenericSetup/content.py 2008-11-20 18:17:58 UTC (rev 93186)
@@ -179,7 +179,9 @@
wrapped = context._getOb(object_id)
- IFilesystemImporter(wrapped).import_(import_context, subdir)
+ adapted = queryAdapter(wrapped, IFilesystemImporter)
+ if adapted is not None:
+ adapted.import_(import_context, subdir)
def _makeInstance(self, instance_id, type_name, subdir, import_context):
Modified: Products.GenericSetup/branches/1.4/Products/GenericSetup/tests/test_content.py
===================================================================
--- Products.GenericSetup/branches/1.4/Products/GenericSetup/tests/test_content.py 2008-11-20 18:12:29 UTC (rev 93185)
+++ Products.GenericSetup/branches/1.4/Products/GenericSetup/tests/test_content.py 2008-11-20 18:17:58 UTC (rev 93186)
@@ -549,6 +549,25 @@
for found_id, expected_id in zip(after, ITEM_IDS):
self.assertEqual(found_id, expected_id)
+ def test_import_site_with_subitems_wo_adapter(self):
+ from Products.GenericSetup.utils import _getDottedName
+ item = _makeItem('no_adapter')
+ dotted = _getDottedName(item.__class__)
+ self._setUpAdapters()
+
+ site = _makeFolder('site')
+
+ context = DummyImportContext(site)
+ # We want to add 'baz' to 'foo', without losing 'bar'
+ context._files['structure/.objects'] = '\n'.join(
+ ['%s,%s' % (x, dotted) for x in ('no_adapter',)])
+ importer = self._getImporter()
+ importer(context)
+
+ after = site.objectIds()
+ self.assertEqual(len(after), 1)
+ self.assertEqual(after[0], 'no_adapter')
+
def test_import_site_with_subitems_and_blanklines_dotobjects(self):
from Products.GenericSetup.utils import _getDottedName
from faux_objects import KNOWN_INI
Modified: Products.GenericSetup/branches/1.4/Products/GenericSetup/version.txt
===================================================================
--- Products.GenericSetup/branches/1.4/Products/GenericSetup/version.txt 2008-11-20 18:12:29 UTC (rev 93185)
+++ Products.GenericSetup/branches/1.4/Products/GenericSetup/version.txt 2008-11-20 18:17:58 UTC (rev 93186)
@@ -1 +1 @@
-1.4.2.2
+1.4.3dev
More information about the Checkins
mailing list