[Zope-CMF] faster way of getting review state of an object ?

Dieter Maurer dieter@handshake.de
Wed, 23 Apr 2003 20:57:14 +0200


Romain Slootmaekers wrote at 2003-4-23 10:59 +0200:
 > I'm trying to list only published items from a list of CMFContent types 
 > and currently, I'm using this code:
 > 
 > result=[]
 > for item in myListOfCMFContentTypes:
 >   reviewState=item.workflow_history['plone_workflow'][-1]['review_state']
 >   if not reviewState == 'published':
 >          result.append(item)
 > 
 > 
 > It works fine,
 > but there must be an easier way to find out if an object is published, no?

There is a "getInfoFor" (or similar).
It is used in the CMF "main_template" to get the workflow state.
Look there, for an example.


Dieter