]> jfr.im git - erebus.git/blobdiff - modules/userinfo.py
trivia add todo
[erebus.git] / modules / userinfo.py
index ab093656a05bdab81baa921365424a263a411c02..9604b8b1d11cd0e2267128ee52867033acaca6a8 100644 (file)
@@ -25,7 +25,13 @@ def modstop(*args, **kwargs):
        return lib.modstop(*args, **kwargs)
 
 # module code
-import json, __builtin__
+import json, sys
+if sys.version_info.major >= 3:
+       import builtins as __builtin__
+       stringbase = str
+else:
+       import __builtin__
+       stringbase = basestring
 
 #setup
 def gotParent():
@@ -44,7 +50,7 @@ def _getauth(thing):
        if isinstance(thing, parent.User):
                if thing.auth is not None:
                        return "#"+thing.auth
-       elif isinstance(thing, basestring):
+       elif isinstance(thing, stringbase):
                if thing.startswith("#"):
                        return thing
                else:
@@ -54,7 +60,7 @@ def _getauth(thing):
        return None
 
 def keys(user):
-       return list(__builtin__.set(db.get(_getauth(user), {}).keys() + db.get(str(user).lower(), {}).keys())) #list-to-set-to-list to remove duplicates
+       return list(__builtin__.set(list(db.get(_getauth(user), {}).keys()) + list(db.get(str(user).lower(), {}).keys()))) #list-to-set-to-list to remove duplicates
 def has(user, key):
        key = key.lower()
        return (