[Zope] Annoying when objectValues() doesn't work
Dieter Maurer
dieter at handshake.de
Fri Jul 4 01:01:11 EDT 2008
Peter Bengtsson wrote at 2008-7-3 15:41 +0100:
>from cStringIO import StringIO
>
>def workflowscripts2methods(self):
> out = StringIO()
>
> print >>out, "Star converting workflow scripts into External Methods"
>
> pw = self.portal_workflow
> for workflow in pw.objectValues('Workflow'):
> for container in workflow.objectValues('Workflow Scripts'):
> meta_type = 'Script (Python)'
> for script in container.objectValues(meta_type):
> assert script.meta_type == meta_type
> print >>out, "script (%r, %s)" % (script.meta_type,
>script.absolute_url_path())
>
>
> value = out.getvalue()
> print value
> return value
>
>
>I'm getting an AssertionError on this!!!
For efficiency reasons, a "Folder" maintains the meta types
used for filtering "object*" in a separate structure (this is
the "_objects" attribute for normal folders).
Your "AssertionError" indicates that this structure is inconsistent
with the true objects.
As long as a folder is only modified by the official "Folder"
api ("_setObject", "_delObject" and higher level functions),
consistency is garanteed. However, lower level functions
can destroy the consistency.
It is not a problem with "objectValues". The problem
must be elsewhere.
--
Dieter
More information about the Zope
mailing list