[Mpuls-commits] r2957 - in base/trunk: . mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Jun 9 18:29:26 CEST 2010


Author: bh
Date: 2010-06-09 18:29:25 +0200 (Wed, 09 Jun 2010)
New Revision: 2957

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/model/user.py
Log:
* mpulsweb/model/user.py (UserObject.setData): The handling of the
login-names is a bit more complex, after all.  In some cases the
data dictionary has the full database login name, sometimes only
the short web login name, but in both cases it's stored under the
"login" key.  So we change the behavior a little and allow the
caller to either specify the full login name in "full_login" or
the short login name in "login".  This fixes a bug introduced with
the earlier change.
(UserListObject.__init__): Store the login name under the key
"full_login" in the data dictionary to adapt to the changed
behavior of UserObject.setData


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-06-09 15:06:36 UTC (rev 2956)
+++ base/trunk/ChangeLog	2010-06-09 16:29:25 UTC (rev 2957)
@@ -1,5 +1,19 @@
 2010-06-09  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/model/user.py (UserObject.setData): The handling of the
+	login-names is a bit more complex, after all.  In some cases the
+	data dictionary has the full database login name, sometimes only
+	the short web login name, but in both cases it's stored under the
+	"login" key.  So we change the behavior a little and allow the
+	caller to either specify the full login name in "full_login" or
+	the short login name in "login".  This fixes a bug introduced with
+	the earlier change.
+	(UserListObject.__init__): Store the login name under the key
+	"full_login" in the data dictionary to adapt to the changed
+	behavior of UserObject.setData
+
+2010-06-09  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/lib/security.py (checkRole.validate): Log the original
 	exception if an OperationalError is raised by the wrapped function
 	before raising the HTTPUnauthorized exception.  The original

Modified: base/trunk/mpulsweb/model/user.py
===================================================================
--- base/trunk/mpulsweb/model/user.py	2010-06-09 15:06:36 UTC (rev 2956)
+++ base/trunk/mpulsweb/model/user.py	2010-06-09 16:29:25 UTC (rev 2957)
@@ -279,7 +279,7 @@
                     login = h.ensure_unicode(r[4])
                     data = {'id': r[0], 'gid': r[5],
                             'firstname': firstname, 'lastname': lastname,
-                            'role': r[3], 'login': login}
+                            'role': r[3], 'full_login': login}
                     uo = UserObject()
                     uo.setData(data)
                     self.user.append(uo)
@@ -539,19 +539,24 @@
         self.activated = data.get('activated', self.activated)
         self.needs_passrefresh = data.get('newpass', self.needs_passrefresh)
 
-        # FIXME: data only contains the login for the web-application,
-        # but not he full login for the database.  Therefore we only set
-        # self.login and set self.full_login to an empty string, since
-        # we cannot really set that here.  Furthermore, given the way
-        # this method is actually used, the login name doesn't even
-        # matter here anyway: after calling setData the caller always
-        # calls either createLogin, in which case the login name is
-        # given explicitly to createLogin again, or the caller calls
-        # store, where the login name is not used at all, because it
-        # cannot be changed for existing users.  Afterwards, the
-        # userobject is not used again.
-        self.login = data.get('login', self.login)
-        self.full_login = ''
+        if "full_login" in data:
+            self.full_login = data.get("full_login", self.full_login)
+            self.login, self.agency = parse_dblogin(self.full_login)
+        else:
+            # FIXME: data does not contain the full login name, but may
+            # contain the the login for the web-application.  Therefore
+            # we only set self.login and set self.full_login to an empty
+            # string, since we cannot really set that here.
+            # Furthermore, given the way this method is actually used
+            # when only the web login name is supplied, the login name
+            # doesn't even matter here anyway: after calling setData the
+            # caller always calls either createLogin, in which case the
+            # login name is given explicitly to createLogin again, or
+            # the caller calls store, where the login name is not used
+            # at all, because it cannot be changed for existing users.
+            # Afterwards, the userobject is not used again.
+            self.login = data.get('login', self.login)
+            self.full_login = ''
 
     def createLogin(self, login=None, role=None, agency=None):
         self.login = login



More information about the Mpuls-commits mailing list