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 .
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".
 getUserById is not used by Zope, only in a safe way (with default=None) by CMF, and only twice by Plone. But it is used by e.g. CMFMember and, somewhat unfortunately, is all over ZTC-based unit tests.
On 13. Dez 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)
-- The time has come to start talking about whether the emperor is as well dressed as we are supposed to think he is. /Pete McBreen/
Zope-Dev maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce