[Zope-Checkins] SVN: Zope/trunk/lib/python/AccessControl/User.py Clarify getUserById as discussed on zope-dev.

Stefan H. Holek stefan at epy.co.at
Tue Jan 25 09:03:34 EST 2005


Log message for revision 28954:
  Clarify getUserById as discussed on zope-dev.
  

Changed:
  U   Zope/trunk/lib/python/AccessControl/User.py

-=-
Modified: Zope/trunk/lib/python/AccessControl/User.py
===================================================================
--- Zope/trunk/lib/python/AccessControl/User.py	2005-01-25 09:53:16 UTC (rev 28953)
+++ Zope/trunk/lib/python/AccessControl/User.py	2005-01-25 14:03:34 UTC (rev 28954)
@@ -488,16 +488,15 @@
         """Return the named user object or None"""
         raise NotImplementedError
 
-    def getUserById(self, id, default=_marker):
+    def getUserById(self, id, default=None):
         """Return the user corresponding to the given id.
         """
         # The connection between getting by ID and by name is not a strong
         # one
-        try:
-            return self.getUser(id)
-        except:
-            if default is _marker: raise
+        user = self.getUser(id)
+        if user is None:
             return default
+        return user
 
     def _doAddUser(self, name, password, roles, domains, **kw):
         """Create a new user. This should be implemented by subclasses to



More information about the Zope-Checkins mailing list