[Zope-dev] getUserById
Florent Guillaume
fg at nuxeo.com
Tue Dec 14 13:27:48 EST 2004
Chris McDonough wrote:
> 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.
Well if for them id != name, they have to override them.
> 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. ;-)
No argument there :)
Stefan wanted some cleanup, why not. Defining the precise semantics is
the first step anyway.
Florent
--
Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the Zope-Dev
mailing list