review_state set to initial state rather than current state

Allen Thomerson athomerson at sympatico.ca
Sun Oct 21 23:54:15 UTC 2007


Sorry! I left out a line of code
    def getMembers(self):
        "caseless sorted list of [(memberId, fullname)]"
        mtool = getToolByName(self, 'portal_membership')
        mb = getToolByName(self, 'membrane_tool')
        wf = getToolByName(self, 'portal_workflow')
        wfmapper = ICategoryMapper(mb)
        members = mtool.listMembers()
        
        decorated = []
        for member in members:
            memberId = member.getMemberId()
            fullname = member.getProperty('fullname', '')
            reviewState = wf.getInfoFor(member, 'review_state',
wf_id='dojo_dojomember_workflow')
            categories = generateCategorySetIdForType('DojoMember')
            if wfmapper.isInCategory(categories, ACTIVE_STATUS_CATEGORY,
reviewState):
                decorated.append( (memberId, fullname))
        decorated.sort(key=operator.itemgetter(1))
        return DisplayList(decorated)


Allen Thomerson wrote:
> 
> I am running Plone 2.5.3 on Zope 2.9.7 with membrane 1.0
> In the code snippet below I am trying to restrict the list of members to
> only those who are in the active state, but when I run it the initial
> state of all the members is returned rather than the current state.  I
> traced through with the debugger and workflow is looking for the
> 'workflow_history' which it doesn't find and sets the return value to the
> initial state.  I think it may have something to do with where I am
> storing members (in the Members folder rather than acl_users), but I don't
> know where to go from here.
> 
>     def getMembers(self):
>         "caseless sorted list of [(memberId, fullname)]"
>         mtool = getToolByName(self, 'portal_membership')
>         mb = getToolByName(self, 'membrane_tool')
>         wf = getToolByName(self, 'portal_workflow')
>         wfmapper = ICategoryMapper(mb)
>         
>         decorated = []
>         for member in members:
>             memberId = member.getMemberId()
>             fullname = member.getProperty('fullname', '')
>             reviewState = wf.getInfoFor(member, 'review_state',
> wf_id='mymember_workflow')
>             categories = generateCategorySetIdForType('MyMember')
>             if wfmapper.isInCategory(categories, ACTIVE_STATUS_CATEGORY,
> reviewState):
>                 decorated.append( (memberId, fullname))
>         decorated.sort(key=operator.itemgetter(1))
>         return DisplayList(decorated)
> 
> 

-- 
View this message in context: http://www.nabble.com/review_state-set-to-initial-state-rather-than-current-state-tf4667816s20094.html#a13334779
Sent from the Product Developers mailing list archive at Nabble.com.





More information about the Product-Developers mailing list