Cast db value to string before comparison
authorSimo Sorce <simo@redhat.com>
Fri, 12 Sep 2014 21:13:14 +0000 (17:13 -0400)
committerPatrick Uiterwijk <puiterwijk@redhat.com>
Wed, 24 Sep 2014 18:29:10 +0000 (20:29 +0200)
Avoid false negatives when the sqlite3 db is 'smart' and automatically
converts the type to integer.

Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
ipsilon/util/user.py

index 9dc0d65..2731d3c 100755 (executable)
@@ -55,7 +55,7 @@ class User(object):
     @property
     def is_admin(self):
         if 'is_admin' in self._userdata:
-            if self._userdata['is_admin'] == '1':
+            if str(self._userdata['is_admin']) == '1':
                 return True
         return False