[Zope3-dev] Zope3 and workflow

Ivo van der Wijk vladdrac at gmail.com
Mon May 2 11:45:52 EDT 2005


Hi,

I'm currently looking into Workflow and Zope3. For some reason, I'm
running into the following, totally undescriptive error:

  File "/home/ivo/Work/Zope3/Zope3-svn/src/zope/app/keyreference/persistent.py",
line 37, in __init__
    IConnection(object).add(object)
  File "/home/ivo/Work/Zope3/Zope3-svn/src/zope/interface/interface.py",
line 697, in __call__
    adapter = self.__adapt__(obj)
  File "/home/ivo/Work/Zope3/Zope3-svn/src/zope/interface/interface.py",
line 765, in __adapt__    adapter = hook(self, obj)
  File "/home/ivo/Work/Zope3/Zope3-svn/src/zope/app/component/hooks.py",
line 95, in adapter_hook
    return siteinfo.adapter_hook(interface, object, name, default)
  File "/home/ivo/Work/Zope3/Zope3-svn/src/zope/interface/adapter.py",
line 406, in adapter_hook
    adapter = factory(object)
  File "/home/ivo/Work/Zope3/Zope3-svn/src/zope/app/keyreference/persistent.py",
line 65, in connectionOfPersistent
    raise ValueError('Can not get connection of %r' % (ob,))
ValueError: Can not get connection of
<zope.app.workflow.stateful.instance.StatefulProcessInstance object at
0xb43a986c>


After some debugging I started debugging the following code:

def NewObjectProcessInstanceCreator(obj, event):
    #  used for: IProcessInstanceContainerAdaptable, IObjectCreatedEvent

    pi_container = IProcessInstanceContainer(obj)

    for (ignored, cwf) in zapi.getUtilitiesFor(IContentWorkflowsManager):
     (.)

        for pd_name in cwf.getProcessDefinitionNamesForObject(obj):

            if pd_name in pi_container.keys():
                continue
            try:
                pi = createProcessInstance(cwf, pd_name)

(zope/app/workflow/stateful/contentworkflow.py)

I'm not really sure what's happening here, but during my debugging
session, *inverting* the test seems alot more logical:

            if pd_name not in pi_container.keys()

Doing this resolved my issue and I ended up with a working workflow.

This is not my code, I know nothing about it - does anyone know if my
fix makes any sense?

Cheers

  Ivo


-- 
Drs. I.R. van der Wijk                                      -=-
Korte Leidsedwarsstraat 12                                 Amaze
1017 RC Amsterdam, NL                                       -=-
T +31-20-4688336         F +31-20-4688337       Zope/Plone/Content Management
W http://www.amaze.nl    E info at amaze.nl           Open Source Solutions
W http://vanderwijk.info E ivo at amaze.nl                 Consultancy
PGP http://vanderwijk.info/pgp


More information about the Zope3-dev mailing list