[Checkins] SVN: AccessControl/trunk/ Return the created user in _doAddUser.

Maurits van Rees m.van.rees at zestsoftware.nl
Mon Jan 10 18:51:30 EST 2011


Log message for revision 119484:
  Return the created user in _doAddUser.

Changed:
  U   AccessControl/trunk/CHANGES.txt
  U   AccessControl/trunk/src/AccessControl/userfolder.py

-=-
Modified: AccessControl/trunk/CHANGES.txt
===================================================================
--- AccessControl/trunk/CHANGES.txt	2011-01-10 23:25:31 UTC (rev 119483)
+++ AccessControl/trunk/CHANGES.txt	2011-01-10 23:51:29 UTC (rev 119484)
@@ -4,6 +4,8 @@
 2.13.4 (unreleased)
 -------------------
 
+- Return the created user in _doAddUser.
+
 - Added IUser interface.
 
 - LP #659968: Added support for level argument to the ``__import__`` function

Modified: AccessControl/trunk/src/AccessControl/userfolder.py
===================================================================
--- AccessControl/trunk/src/AccessControl/userfolder.py	2011-01-10 23:25:31 UTC (rev 119483)
+++ AccessControl/trunk/src/AccessControl/userfolder.py	2011-01-10 23:51:29 UTC (rev 119484)
@@ -92,7 +92,8 @@
         """Create a new user. This should be implemented by subclasses to
            do the actual adding of a user. The 'password' will be the
            original input password, unencrypted. The implementation of this
-           method is responsible for performing any needed encryption."""
+           method is responsible for performing any needed encryption.
+           The implementation should return the created user or None."""
         raise NotImplementedError
 
     def _doChangeUser(self, name, password, roles, domains, **kw):
@@ -398,11 +399,14 @@
         return not not len(self.data)
 
     def _doAddUser(self, name, password, roles, domains, **kw):
-        """Create a new user"""
+        """Create a new user
+
+        Note that an existing user of this name is simply overwritten."""
         if password is not None and self.encrypt_passwords \
                                 and not self._isPasswordEncrypted(password):
             password = self._encryptPassword(password)
         self.data[name] = User(name, password, roles, domains)
+        return self.data[name]
 
     def _doChangeUser(self, name, password, roles, domains, **kw):
         user=self.data[name]



More information about the checkins mailing list