Removed errant import.
[zzz-floof.git] / floof / controllers / users.py
1 import logging
2
3 from pylons import request, response, session, tmpl_context as c
4 from pylons.controllers.util import abort, redirect_to
5 from sqlalchemy.orm.exc import NoResultFound
6
7 from floof.lib.base import BaseController, render
8 from floof.model.users import User, UserRelationship
9
10 log = logging.getLogger(__name__)
11
12 class UsersController(BaseController):
13
14 def list(self):
15 """List of all users."""
16
17 # TODO paging!
18 c.users = User.query.all()
19
20 return render('/users/index.mako')
21
22 def view(self, name):
23 """Userpage."""
24
25 try:
26 c.this_user = User.get_by(name=name)
27 except NoResultFound:
28 abort(404)
29
30 rels = UserRelationship.query.filter_by(
31 user_id=c.user.id,
32 target_user_id=c.this_user.id,
33 ).all()
34
35 c.relationships = [_.type for _ in rels]
36
37 return render('/users/view.mako')