]> jfr.im git - irc/rizon/acid.git/commitdiff
When unserlializing collectionentitiys properly store ban set/expiry as ints
authorAdam <redacted>
Wed, 15 Oct 2014 21:35:03 +0000 (17:35 -0400)
committerAdam <redacted>
Wed, 15 Oct 2014 21:35:03 +0000 (17:35 -0400)
pyva/pyva/src/main/python/esim/esim_users.py
pyva/pyva/src/main/python/pseudoclient/collection.py

index 87a32149911f4b137b3470ad592e7f2b57e83cc6..aee9fd08c305adda855770853ea60c2e66634b02 100644 (file)
@@ -1,7 +1,7 @@
 from pseudoclient.collection import *
 from pseudoclient.sys_users import *
 
-class EsimUser(CollectionEntity):
+class EsimUser(User):
        citizen = None
        company = None
 
index 31ebf971e8171a84e63fce17362d6769f77af4b3..13de0bad427a4edaa3ece3d47ff67ba59bc5ac6f 100644 (file)
@@ -53,6 +53,14 @@ class CollectionEntity(object):
                self.dirty = False
                self.registered = self.banned = False
 
+       def unserialize(self, key, value):
+               if key == 'ban_date':
+                       self.ban_date = int(value)
+               elif key == 'ban_expiry':
+                       self.ban_expiry = int(value)
+               else:
+                       setattr(self, key, value)
+
 class CollectionManager(InvariantCollection):
        def __init__(self, type):
                InvariantCollection.__init__(self)
@@ -83,7 +91,7 @@ class CollectionManager(InvariantCollection):
                        self.cursor.execute("SELECT name,value FROM " + self.module.name + "_" + self.name + "_options WHERE `id` = %s", (id,))
                        r2 = self.cursor.fetchall()
                        for row2 in r2:
-                               setattr(e, row2[0], row2[1])
+                               e.unserialize(row2[0], row2[1])
 
        def __get_attributes(self, obj):
                boring = dir(type('dummy', (object,), {}))