[Zope-CMF] wrong review_state DURING state transition

Romain Slootmaekers romain at zzict.com
Mon Dec 1 19:26:55 EST 2003


Yo,

I have a product installer that does various things, including 
instantiating, copying, publishing some content items and updating the 
portal catalog.

Some of the items are published in the installer using the following code:

workflows=plone.portal_workflow.getWorkflowsFor(o)
workflow= workflows[0]

if o.isPrincipiaFolderish :
     workflow.doActionFor(o, 'publish')
     childIds=o.objectIds()
     _publish(o,childIds,plone) #recurse...
else:
     workflow.doActionFor(o, 'publish')



This works fine.

The state transition triggers a reindexObject call on the object in 
question, but if I try to access the review_state of that object inside 
the reindexObject method, with following code snippet:

workflows = self.portal_workflow.getWorkflowsFor(self)
workflow = workflows[0]
state = workflow.getInfoFor(self, 'review_state','')


it returns the old review state, and not 'published' .

Using a more direct approach with:
workflow_history['plone_workflow'][-1]['review_state']


does not help.

Googling for a solution, I found
http://www.mmmanager.org/collectors/cmf_article/18

But the content type class has following inheritence signature:

class MyType (PortalContent, DefaultDublinCoreImpl ):
     """

     """
     __implements__ = ( PortalContent.__implements__,
                        DefaultDublinCoreImpl.__implements__
                      )

     ...


So it inherits from CMFCatalogAware via 
PortalContent(DynamicType,CMFCatalogAware,SimpleItem) first

(Changing the inheritence order does not change the behavior... I tried)



So, my questions:
- is this a bug, a feature, or am I trying to access the review state in 
   the wrong way ?

- is there another method called after a state change more suited for 
installing my "state change push -through to something else", than 
reindexObject ? I tried "notifyModified", buth that doesn't get called 
on every state change, so it seems.

For the record: this is CMF 1.3.2 and plone 1.0.5

TIA,

Romain Slootmaekers.






More information about the Zope-CMF mailing list