diff options
author | Michaël Ball <michael.ball@gmail.com> | 2017-06-17 09:52:17 +0100 |
---|---|---|
committer | Michaël Ball <michael.ball@gmail.com> | 2017-06-17 09:56:47 +0100 |
commit | 3296708955e111579f00da8054ed2a4a86834766 (patch) | |
tree | 59ec22239b1c3cd23ec8e843249c85b543f679d2 /models | |
parent | d06f96388d754ed41876f7fccb63f84241d44963 (diff) |
Support setting transcode command.
Diffstat (limited to 'models')
-rw-r--r-- | models/user.py | 14 |
1 files changed, 13 insertions, 1 deletions
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 |