[Zope] Re: review_state

Maurits van Rees m.van.rees at zestsoftware.nl
Fri Jun 1 06:28:55 EDT 2007


julian, on 2007-06-01:
> from Products.CMFCore.utils import getToolByName
> from Products.CMFCore.permissions import ManagePortal
>
> query = {'portal_type' : 'Document',
>          }
>
> for prestataire in self.portal_catalog.searchResults(query):
>        presta_obj = prestataire.getObject()
>        wflow = getToolByName(presta_obj, "portal_workflow", None)
>        if wflow is not None:
>             review_state = wflow.getInfoFor(presta_obj, "review_state")
> -----------------------------------------------------
>
> So review_state = published or visible...
>
> My problem is resolve :)

Great!

Some notes that may still help:

- I would expect review_state to be in the catalog as well, so instead
  of using getObject first you could do:

  review_state = prestataire.review_state

- Should you then also want the title or name of the state:

  review_state_title = wflow.getTitleForStateOnType(
                         review_state, 'Document')

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
            Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."



More information about the Zope mailing list