[Checkins] SVN: Products.CMFCore/branches/2.1/Products/CMFCore/ -
exportimport.content: Add simple guard against import failures when
Jens Vagelpohl
jens at dataflake.org
Sun Dec 30 07:21:48 EST 2007
Log message for revision 82569:
- exportimport.content: Add simple guard against import failures when
the ".objects" file contains empty lines.
(https://bugs.launchpad.net/zope-cmf/+bug/176328)
Changed:
U Products.CMFCore/branches/2.1/Products/CMFCore/CHANGES.txt
U Products.CMFCore/branches/2.1/Products/CMFCore/exportimport/content.py
U Products.CMFCore/branches/2.1/Products/CMFCore/exportimport/tests/test_content.py
-=-
Modified: Products.CMFCore/branches/2.1/Products/CMFCore/CHANGES.txt
===================================================================
--- Products.CMFCore/branches/2.1/Products/CMFCore/CHANGES.txt 2007-12-30 11:39:40 UTC (rev 82568)
+++ Products.CMFCore/branches/2.1/Products/CMFCore/CHANGES.txt 2007-12-30 12:21:47 UTC (rev 82569)
@@ -1,5 +1,12 @@
Products.CMFCore Changelog
+ Products.CMFCore 2.1.1 (unreleased)
+
+ - exportimport.content: Add simple guard against import failures when
+ the ".objects" file contains empty lines.
+ (https://bugs.launchpad.net/zope-cmf/+bug/176328)
+
+
Products.CMFCore 2.1.1-beta (2007/12/29)
- Events: Fixed some handleContentishEvent issues.
@@ -21,7 +28,7 @@
object.
- Products.CMFCore 2.1.0 (2007-08-08)
+ Products.CMFCore 2.1.0 (2007/08/08)
First egg release. For changes up through this release, please see
the overall "CMF changelog",
Modified: Products.CMFCore/branches/2.1/Products/CMFCore/exportimport/content.py
===================================================================
--- Products.CMFCore/branches/2.1/Products/CMFCore/exportimport/content.py 2007-12-30 11:39:40 UTC (rev 82568)
+++ Products.CMFCore/branches/2.1/Products/CMFCore/exportimport/content.py 2007-12-30 12:21:47 UTC (rev 82569)
@@ -131,7 +131,7 @@
stream = StringIO(objects)
rowiter = reader(stream, dialect)
- ours = tuple(rowiter)
+ ours = filter(None, tuple(rowiter))
our_ids = set([item[0] for item in ours])
prior = set(context.contentIds())
Modified: Products.CMFCore/branches/2.1/Products/CMFCore/exportimport/tests/test_content.py
===================================================================
--- Products.CMFCore/branches/2.1/Products/CMFCore/exportimport/tests/test_content.py 2007-12-30 11:39:40 UTC (rev 82568)
+++ Products.CMFCore/branches/2.1/Products/CMFCore/exportimport/tests/test_content.py 2007-12-30 12:21:47 UTC (rev 82569)
@@ -406,6 +406,31 @@
for found_id, expected_id in zip(after, ITEM_IDS):
self.assertEqual(found_id, expected_id)
+ def test_import_site_with_subitems_and_blanklines_dotobjects(self):
+ self._setUpAdapters()
+ ITEM_IDS = ('foo', 'bar', 'baz')
+
+ site = _makeFolder('site', site_folder=True)
+
+ context = DummyImportContext(site)
+ # We want to add 'baz' to 'foo', without losing 'bar'
+ correct = '\n'.join(['%s,%s' % (x, TEST_INI_AWARE) for x in ITEM_IDS])
+ broken = correct + '\n\n'
+ context._files['structure/.objects'] = broken
+ for index in range(len(ITEM_IDS)):
+ id = ITEM_IDS[index]
+ context._files[
+ 'structure/%s.ini' % id] = KNOWN_INI % ('Title: %s' % id,
+ 'xyzzy',
+ )
+ importer = self._getImporter()
+ importer(context)
+
+ after = site.objectIds()
+ self.assertEqual(len(after), len(ITEM_IDS))
+ for found_id, expected_id in zip(after, ITEM_IDS):
+ self.assertEqual(found_id, expected_id)
+
def test_import_site_with_subitem_unknown_portal_type(self):
self._setUpAdapters()
ITEM_IDS = ('foo', 'bar', 'baz')
More information about the Checkins
mailing list