[Zope3-Users] Getting all principals from PAU

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Jul 15 13:13:17 EDT 2005


On Tuesday 28 June 2005 15:51, Florian Lindner wrote:
> But I suspect this code to be highly dependend of the principal folder.

Correct.

> What is the best and most generic way to do that?

This is not so easy, since every queriable could have a different API for 
searching. A queriable always describes a search schema. From this search 
schema you can build a query mapping that is passed into the search() 
function of the queriable. I think you best bet would be to choose the 
default value for each field. Here some untested code:

user_ids = []
for name, queriable in pau.getQueriables():
  q = {}
  for n, f in queriable.schema.namesAndDescriptions():
    q[n] = f.default
  user_ids += list(queriable.search(q))  

users = [pau.getPrincipal(id) for id in user_ids]

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list