diff options
author | Jessica Tallon <tsyesika@tsyesika.se> | 2015-07-17 17:51:51 +0200 |
---|---|---|
committer | Jessica Tallon <tsyesika@tsyesika.se> | 2015-07-31 15:15:24 +0200 |
commit | d88fcb03e2e520da6a7d0203d660e4536108f56b (patch) | |
tree | 75b751fae15a037301bb384e64eba13746cb57a6 /mediagoblin/gmg_commands/addmedia.py | |
parent | 283e6d8b9f09341e3b97418b79f389bfdfee6498 (diff) | |
download | mediagoblin-d88fcb03e2e520da6a7d0203d660e4536108f56b.tar.lz mediagoblin-d88fcb03e2e520da6a7d0203d660e4536108f56b.tar.xz mediagoblin-d88fcb03e2e520da6a7d0203d660e4536108f56b.zip |
Change codebase to query or create correct User model
The code base had many references to User.username and other
specific to LocalUser attributes as that was the way it use to exist.
This updates those to query on the generic User model but filtering
by attributes on the LocalUser.
Diffstat (limited to 'mediagoblin/gmg_commands/addmedia.py')
-rw-r--r-- | mediagoblin/gmg_commands/addmedia.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mediagoblin/gmg_commands/addmedia.py b/mediagoblin/gmg_commands/addmedia.py index 2aa8f96a..2c376b76 100644 --- a/mediagoblin/gmg_commands/addmedia.py +++ b/mediagoblin/gmg_commands/addmedia.py @@ -20,6 +20,7 @@ import os import six +from mediagoblin.db.models import LocalUser from mediagoblin.gmg_commands import util as commands_util from mediagoblin.submit.lib import ( submit_media, get_upload_file_limits, @@ -70,7 +71,9 @@ def addmedia(args): app = commands_util.setup_app(args) # get the user - user = app.db.User.query.filter_by(username=args.username.lower()).first() + user = app.db.User.query.filter( + LocalUser.username==args.username.lower() + ).first() if user is None: print("Sorry, no user by username '%s'" % args.username) return |