Migrating the OpenFlow project from Zope 2.7.x to 2.9.x (and 2.10.x)
Hi all. I'm in the business of migrating OpenFlow from Zope 2.7.x (where it lived peacefully) to Zope 2.9 and 2.10 (i.e. I'm in the process of 2.9, and then I will move to 2.10). As a first step, I've run the unit tests for the project, and just one is failing, the following one: <code> def afterSetUp(self): self.zope = self.app # create an openflow self.zope.manage_addProduct['OpenFlow'].manage_addOpenflow(id='OF') self.of = getattr(self.zope, 'OF') # Create a Process Definition with two activities (Begin, End)... self.of.addProcess(id='begin_end', BeginEnd=1) self.pd = getattr(self.of, 'begin_end') # ...and one transition linking them self.pd.addTransition(id='begin_end', From='Begin', To='End') loginUnrestricted() def testCopyOpenflow(self): cataloged_items = len(self.of.Catalog()) cb = self.zope.manage_copyObjects([self.of.id]) try: for i in [self.of, self.pd] + self.pd.objectValues(): assert hasattr(i.aq_base, 'getId'), "missing %s" % i.id assert i._getCopy(self.zope) is not None, "getcopy not in %s" % i.id except AssertionError: # this test is tough to make! how to do this? return self.zope.manage_pasteObjects(cb) new_of = getattr(self.zope, 'copy_of_'+self.of.id) self.assertEquals(len(new_of.Catalog()),cataloged_items) </code> Just for a little of further knowledge: OpenFlow creates a Catalog, which is used to access all the data of the Workflow (processes, instancess, workitems, etc.) The assertion failing is the last one, because I get a length of 0 as a result of the query of the catalog. Can someone point me to differences between 2.7 and 2.9 in the handling of the paste action? Regards Marco -- Marco Bizzarri http://iliveinpisa.blogspot.com/
Marco Bizzarri wrote at 2007-2-10 21:33 +0100:
... cb = self.zope.manage_copyObjects([self.of.id]) ... self.zope.manage_pasteObjects(cb) new_of = getattr(self.zope, 'copy_of_'+self.of.id) self.assertEquals(len(new_of.Catalog()),cataloged_items) </code>
Just for a little of further knowledge: OpenFlow creates a Catalog, which is used to access all the data of the Workflow (processes, instancess, workitems, etc.)
The assertion failing is the last one, because I get a length of 0 as a result of the query of the catalog.
Can someone point me to differences between 2.7 and 2.9 in the handling of the paste action?
I do not yet use Zope 2.9. Therefore, my answer is very hypothetical: In earlier versions, copying a catalog contained a bug: The catalogued objects were twice in the catalog. A first time because they have been copied with the catalog itself and a second time due to the "manage_afterAdd" call for the true object copy. Maybe, "OpenFlow" contains some code to avoid this catalog copying problem -- and maybe, the buggy behaviour was fixed in Zope itself. Then, the correcting actions of "OpenFlow" might do too much. -- Dieter
participants (2)
-
Dieter Maurer -
Marco Bizzarri