[Zope-dev] getUserById

Chris McDonough chrism at plope.com
Tue Dec 14 13:03:27 EST 2004


On Tue, 2004-12-14 at 12:37 +0100, Florent Guillaume wrote:
> def getUserById(self, id, default=None):
>     user = self.getUser(id)
>     if user is not None:
>         return user
>     return default

> or even:
> 
> def getUserById(self, id, default=None):
>     return self.getUser(id) or default

FWIW, I assume it's understood that neither of these will do the right
thing for anything except the default Zope user folder (aka
"UserFolder"), so it's arguable that these implementations probably
shouldn't go into the BasicUserFolder base class (which is a base class
for "UserFolder" and maybe a lot of other user folders).  That said, I
think every other user folder implementation on the planet overrides
these methods.  FWIW, the user folder API is a complete mess (there
really is no sane API).  It might be best to just step away slowly from
this unless you want to own it. ;-)

- C




More information about the Zope-Dev mailing list