[Zope-dev] getUserById

Florent Guillaume fg at nuxeo.com
Tue Dec 14 06:40:44 EST 2004


In article <E6A43D56-4D33-11D9-8ED8-000D93325646 at epy.co.at> you write:
> Hm, I'd rather not raise exceptions.
> 
> getUserById was introduced in Zope 2.2 and since then has never raised 
> anything. From what I can see it is used as a kind of alias for 
> getUser, expected to return None if the user does not exist.
> 
> So, my intention is to make 'default' work, not to make it raise. I see 
> that raising may seem like a more consistent idea (think dict.get) but 
> it may also break existing code [1].

Well dict.get is the exception in the python world. Everything else that
has an optional default value raises an exception if no result is
available and the default value is not provided.

> My secret agenda is to unify the behavior of getUserById across user 
> folders. As it is now, LDAPUserFolder, GRUF, etc all implement their 
> own little variations because the default is so "strange".

Indeed, these methods lacks clear interfaces.

FWIW CPSUserFolder is at:
http://cvs.nuxeo.org/cgi-bin/viewcvs.cgi/CPS3/CPSUserFolder/CPSUserFolder.py?rev=HEAD&content-type=text/vnd.viewcvs-markup

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