From 3296708955e111579f00da8054ed2a4a86834766 Mon Sep 17 00:00:00 2001 From: Michaƫl Ball Date: Sat, 17 Jun 2017 09:52:17 +0100 Subject: Support setting transcode command. --- models/user.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'models/user.py') diff --git a/models/user.py b/models/user.py index ea90f39..4d4887f 100644 --- a/models/user.py +++ b/models/user.py @@ -1,8 +1,9 @@ +"""Define a user.""" from os import urandom from itsdangerous import URLSafeTimedSerializer -from common.security import pwd_context, secret_key +from common.security import pwd_context class User(object): @@ -57,3 +58,14 @@ class User(object): else: raise ValueError("No user") + + def to_dict(self): + """Return a dict representation of the user.""" + return_dict = dict() + for key, item in self.__dict__.items(): + try: + return_dict[key] = item.to_dict() + except AttributeError: + return_dict[key] = item + + return return_dict -- cgit v1.2.3