X-Git-Url: http://git.veekun.com/zzz-floof.git/blobdiff_plain/f263f51648eef9739caa92e19ec45b32d7a1e49e..79cb1c0d3048c165fd3b9ff287ee1fbe361f904d:/floof/controllers/users.py?ds=sidebyside diff --git a/floof/controllers/users.py b/floof/controllers/users.py index 1a79c15..4c9bb9c 100644 --- a/floof/controllers/users.py +++ b/floof/controllers/users.py @@ -2,7 +2,6 @@ import logging from pylons import request, response, session, tmpl_context as c from pylons.controllers.util import abort, redirect_to -from sqlalchemy import func from sqlalchemy.orm.exc import NoResultFound from floof.lib.base import BaseController, render @@ -24,16 +23,16 @@ class UsersController(BaseController): """Userpage.""" try: - c.this_user = User.query.filter(func.lower(User.name) == name) \ - .one() + c.this_user = User.get_by(name=name) except NoResultFound: abort(404) - rels = UserRelationship.query.filter_by( - user_id=c.user.id, - target_user_id=c.this_user.id, - ).all() + if c.user: + rels = UserRelationship.query.filter_by( + user_id=c.user.id, + target_user_id=c.this_user.id, + ).all() - c.relationships = [_.type for _ in rels] + c.relationships = [_.type for _ in rels] return render('/users/view.mako')