Personal tools
getPeople
Python script to pull in the whole roster of members and return a sorted dictionary of all member properties. Requires the 'sortname' string field to have been added to portal_memberdata Properties tab. This script is used by the people_folder_listing view template.
## Script (Python) "getPeople"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
# pull in whole membership list as a list of dictionaries, sorted by
'sortname'
roster = context.portal_membership.getRoster()
people = []
for person in roster:
if person['listed']:
propdict = {}
member =
context.portal_membership.getMemberById(person['id'])
for property in
context.portal_memberdata.propertyIds():
propdict[property] =
member.getProperty(property)
propdict['id'] = person['id']
people.append(propdict)
decorated = [(dict_['sortname'], dict_) for dict_ in people]
decorated.sort()
sortedpeople = [dict_ for (key,dict_) in decorated]
return sortedpeople