[Zope-dev] getUserById
Jens Vagelpohl
jens at dataflake.org
Mon Dec 13 12:13:23 EST 2004
On Dec 13, 2004, at 17:15, Florent Guillaume wrote:
> Can we have instead:
>
> def getUserById(self, id, default=_marker):
> """Return the user corresponding to the given id.
>
> Raises a KeyError if the user does not exist and no default
> is provided.
> """
> user = self.getUser(id)
> if user is not None:
> return user
> if default is not _marker:
> return default
> raise KeyError(id)
What is the advantage of throwing a KeyError over simply returning
None? I don't see the reason for "getUser" and "getUserById" behaving
in different ways here. They should both behave similar.
jens
More information about the Zope-Dev
mailing list