diff options
Diffstat (limited to 'module/utils/__init__.py')
-rw-r--r-- | module/utils/__init__.py | 4 |
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""" |