summaryrefslogtreecommitdiffstats
path: root/module/utils
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-01-06 15:54:52 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-01-06 15:54:52 +0100
commit6f8b5347dfa119a3df21f4ca8ba8c2b1537a726a (patch)
tree627c4d99f0aaa4c8022b70b3ebe72f201d924dd6 /module/utils
parentremoved unneeded stuff (diff)
downloadpyload-6f8b5347dfa119a3df21f4ca8ba8c2b1537a726a.tar.xz
first working parts of config api
Diffstat (limited to 'module/utils')
-rw-r--r--module/utils/__init__.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/module/utils/__init__.py b/module/utils/__init__.py
index 3adb695ee..4692c59cb 100644
--- a/module/utils/__init__.py
+++ b/module/utils/__init__.py
@@ -221,6 +221,10 @@ def get_index(l, value):
# Matches behavior of list.index
raise ValueError("list.index(x): x not in list")
+def primary_uid(user):
+ """ Gets primary user id for user instances or ints """
+ if type(user) == int: return user
+ return user.primary if user else None
def html_unescape(text):
"""Removes HTML or XML character references and entities from a text string"""