Commit 00578f52 authored by Stefan H. Holek's avatar Stefan H. Holek

Clarify getUserById as discussed on zope-dev.

parent 9f472ef9
...@@ -488,16 +488,15 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager, ...@@ -488,16 +488,15 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
"""Return the named user object or None""" """Return the named user object or None"""
raise NotImplementedError raise NotImplementedError
def getUserById(self, id, default=_marker): def getUserById(self, id, default=None):
"""Return the user corresponding to the given id. """Return the user corresponding to the given id.
""" """
# The connection between getting by ID and by name is not a strong # The connection between getting by ID and by name is not a strong
# one # one
try: user = self.getUser(id)
return self.getUser(id) if user is None:
except:
if default is _marker: raise
return default return default
return user
def _doAddUser(self, name, password, roles, domains, **kw): def _doAddUser(self, name, password, roles, domains, **kw):
"""Create a new user. This should be implemented by subclasses to """Create a new user. This should be implemented by subclasses to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment