[Checkins] SVN: zope.fssync/trunk/ Fixed exception raising on unpickling errors when checking in.
Thomas Lotze
cvs-admin at zope.org
Thu May 2 08:29:15 UTC 2013
Log message for revision 130220:
Fixed exception raising on unpickling errors when checking in.
Changed:
U zope.fssync/trunk/CHANGES.txt
U zope.fssync/trunk/src/zope/fssync/task.py
U zope.fssync/trunk/src/zope/fssync/tests/test_task.py
-=-
Modified: zope.fssync/trunk/CHANGES.txt
===================================================================
--- zope.fssync/trunk/CHANGES.txt 2013-05-01 16:31:10 UTC (rev 130219)
+++ zope.fssync/trunk/CHANGES.txt 2013-05-02 08:29:15 UTC (rev 130220)
@@ -4,6 +4,8 @@
3.6.1 (unreleased)
------------------
+- Fixed exception raising on unpickling errors when checking in.
+
- Improved reporting of unpickling errors.
Modified: zope.fssync/trunk/src/zope/fssync/task.py
===================================================================
--- zope.fssync/trunk/src/zope/fssync/task.py 2013-05-01 16:31:10 UTC (rev 130219)
+++ zope.fssync/trunk/src/zope/fssync/task.py 2013-05-02 08:29:15 UTC (rev 130220)
@@ -523,6 +523,13 @@
else:
raise SynchronizationError("object already exists %r" % name)
+ # check for errors
+ if self.errors:
+ if len(self.errors) == 1:
+ raise Exception(self.errors[0])
+ else:
+ raise Exceptions("\n ".join([""] + self.errors))
+
# process callbacks
passes = 0
callbacks = [cb for cb in callbacks if cb is not None]
Modified: zope.fssync/trunk/src/zope/fssync/tests/test_task.py
===================================================================
--- zope.fssync/trunk/src/zope/fssync/tests/test_task.py 2013-05-01 16:31:10 UTC (rev 130219)
+++ zope.fssync/trunk/src/zope/fssync/tests/test_task.py 2013-05-02 08:29:15 UTC (rev 130220)
@@ -301,6 +301,25 @@
self.assertEqual(container.holding["foo"].__class__, PretendContainer)
+class TestCheckinClass(TestBase):
+
+ def test_pickle_error_is_reported(self):
+ parentdir = self.tempdir()
+ foofile = os.path.join(parentdir, 'foo')
+ self.writefile(
+ '<?xml version="1.0" encoding="utf-8" ?><pickle><foo</pickle>',
+ foofile, 'wb')
+ metadata = MockMetadata()
+ metadata.getentry(foofile)['path'] = 'foo'
+
+ filesystem = repository.FileSystemRepository(metadata=metadata)
+ checkin = task.Checkin(synchronizer.getSynchronizer, filesystem)
+
+ container = PretendContainer()
+ self.assertRaises(
+ Exception, checkin.perform, container, 'foo', foofile)
+
+
class TestCheckClass(TestBase):
def setUp(self):
@@ -743,6 +762,7 @@
s = unittest.TestSuite()
s.addTest(unittest.makeSuite(TestTaskModule))
s.addTest(unittest.makeSuite(TestCommitClass))
+ s.addTest(unittest.makeSuite(TestCheckinClass))
s.addTest(unittest.makeSuite(TestCheckClass))
s.addTest(unittest.makeSuite(TestCheckAndCommit))
s.addTest(unittest.makeSuite(TestCallback))
More information about the checkins
mailing list