[Mpuls-commits] r1028 - in wasko/branches/2.0: . waskaweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jan 29 18:16:05 CET 2010


Author: bh
Date: 2010-01-29 18:16:04 +0100 (Fri, 29 Jan 2010)
New Revision: 1028

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/waskaweb/model/user.py
Log:
* waskaweb/model/user.py (UserGroupList.__init__)
(UserGroupFactory.load, UserListObject.__init__)
(UserObject._fetchData): Use ensure_unicode to convert to unicode
instead of hardcoding the conversion inline.


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-01-29 17:14:51 UTC (rev 1027)
+++ wasko/branches/2.0/ChangeLog	2010-01-29 17:16:04 UTC (rev 1028)
@@ -1,5 +1,12 @@
 2010-01-29  Bernhard Herzog  <bh at intevation.de>
 
+	* waskaweb/model/user.py (UserGroupList.__init__)
+	(UserGroupFactory.load, UserListObject.__init__)
+	(UserObject._fetchData): Use ensure_unicode to convert to unicode
+	instead of hardcoding the conversion inline.
+
+2010-01-29  Bernhard Herzog  <bh at intevation.de>
+
 	* waskaweb/lib/security.py (checkLogin)
 	(load_db_mapping_from_file, getDbName): Improve logging.
 

Modified: wasko/branches/2.0/waskaweb/model/user.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/user.py	2010-01-29 17:14:51 UTC (rev 1027)
+++ wasko/branches/2.0/waskaweb/model/user.py	2010-01-29 17:16:04 UTC (rev 1028)
@@ -94,7 +94,7 @@
                 cur = conn.cursor()
                 cur.execute(FETCH_USERGROUP_LIST_SQL)
                 for r in cur.fetchall():
-                    name = unicode(str(r[1]), 'utf-8')
+                    name = h.ensure_unicode(r[1])
                     data = {'id': r[0], 'name': name}
                     o = UserGroup()
                     o.setData(data)
@@ -142,7 +142,7 @@
                 cur = conn.cursor()
                 cur.execute(FETCH_USERGROUP_DATA_SQL, fields)
                 r = cur.fetchone()
-                name = unicode(str(r[1]), 'utf-8')
+                name = h.ensure_unicode(r[1])
                 data = {'id': r[0], 'name': name}
                 group.setData(data)
             finally:
@@ -261,9 +261,9 @@
                 cur = conn.cursor()
                 cur.execute(FETCH_USER_LIST_SQL)
                 for r in cur.fetchall():
-                    firstname = unicode(str(r[1]), 'utf-8')
-                    lastname = unicode(str(r[2]), 'utf-8')
-                    login = unicode(str(r[4]), 'utf-8')
+                    firstname = h.ensure_unicode(r[1])
+                    lastname = h.ensure_unicode(r[2])
+                    login = h.ensure_unicode(r[4])
                     data = {'id': r[0], 'gid': r[5],
                             'firstname': firstname, 'lastname': lastname,
                             'role': r[3], 'login': login}
@@ -484,14 +484,14 @@
             if not ud is None:
                 # Set userdata
                 self.id = ud[0]
-                self.first_name = unicode(str(ud[1]), 'utf-8')
-                self.last_name = unicode(str(ud[2]), 'utf-8')
-                self.telephone = unicode(str(ud[3]), 'utf-8')
+                self.first_name = h.ensure_unicode(ud[1])
+                self.last_name = h.ensure_unicode(ud[2])
+                self.telephone = h.ensure_unicode(ud[3])
                 self.activated = ud[4]
                 self.needs_passrefresh = ud[5]
-                self.full_login = unicode(str(ud[6]), 'utf-8')
-                self.room = unicode(str(ud[7]), 'utf-8')
-                self.branchoffice = unicode(str(ud[8]), 'utf-8')
+                self.full_login = h.ensure_unicode(ud[6])
+                self.room = h.ensure_unicode(ud[7])
+                self.branchoffice = h.ensure_unicode(ud[8])
                 self.oid = ud[9]
                 self.standin = ud[10]
                 self.role = ud[11]



More information about the Mpuls-commits mailing list