aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/user_pages/views.py
diff options
context:
space:
mode:
authorJessica Tallon <tsyesika@tsyesika.se>2015-07-17 17:51:51 +0200
committerJessica Tallon <tsyesika@tsyesika.se>2015-07-31 15:15:24 +0200
commitd88fcb03e2e520da6a7d0203d660e4536108f56b (patch)
tree75b751fae15a037301bb384e64eba13746cb57a6 /mediagoblin/user_pages/views.py
parent283e6d8b9f09341e3b97418b79f389bfdfee6498 (diff)
downloadmediagoblin-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/user_pages/views.py')
-rw-r--r--mediagoblin/user_pages/views.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index cc7f3684..33ca7c40 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -22,7 +22,7 @@ import six
from mediagoblin import messages, mg_globals
from mediagoblin.db.models import (MediaEntry, MediaTag, Collection,
- CollectionItem, User, Activity)
+ CollectionItem, LocalUser, Activity)
from mediagoblin.tools.response import render_to_response, render_404, \
redirect, redirect_obj
from mediagoblin.tools.text import cleaned_markdown_conversion
@@ -53,8 +53,8 @@ _log.setLevel(logging.DEBUG)
@user_not_banned
@uses_pagination
def user_home(request, page):
- """'Homepage' of a User()"""
- user = User.query.filter_by(username=request.matchdict['user']).first()
+ """'Homepage' of a LocalUser()"""
+ user = LocalUser.query.filter_by(username=request.matchdict['user']).first()
if not user:
return render_404(request)
elif not user.has_privilege(u'active'):
@@ -90,7 +90,7 @@ def user_home(request, page):
@active_user_from_url
@uses_pagination
def user_gallery(request, page, url_user=None):
- """'Gallery' of a User()"""
+ """'Gallery' of a LocalUser()"""
tag = request.matchdict.get('tag', None)
cursor = MediaEntry.query.filter_by(
uploader=url_user.id,
@@ -485,7 +485,7 @@ def atom_feed(request):
"""
generates the atom feed with the newest images
"""
- user = User.query.filter_by(
+ user = LocalUser.query.filter_by(
username = request.matchdict['user']).first()
if not user or not user.has_privilege(u'active'):
return render_404(request)
@@ -547,7 +547,7 @@ def collection_atom_feed(request):
"""
generates the atom feed with the newest images from a collection
"""
- user = User.query.filter_by(
+ user = LocalUser.query.filter_by(
username = request.matchdict['user']).first()
if not user or not user.has_privilege(u'active'):
return render_404(request)
@@ -617,7 +617,7 @@ def processing_panel(request):
Show to the user what media is still in conversion/processing...
and what failed, and why!
"""
- user = User.query.filter_by(username=request.matchdict['user']).first()
+ user = LocalUser.query.filter_by(username=request.matchdict['user']).first()
# TODO: XXX: Should this be a decorator?
#
# Make sure we have permission to access this user's panel. Only
@@ -705,7 +705,7 @@ def activity_view(request):
"""
# Get the user object.
username = request.matchdict["username"]
- user = User.query.filter_by(username=username).first()
+ user = LocalUser.query.filter_by(username=username).first()
activity_id = request.matchdict["id"]