1e251f0b261cf0bd6c0c1bd38ef8ad83c5062ca4
[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 import func
6 from sqlalchemy.orm.exc import NoResultFound
7
8 from floof.lib.base import BaseController, render
9 from floof.model.users import User
10
11 log = logging.getLogger(__name__)
12
13 class UsersController(BaseController):
14
15 def list(self):
16 """List of all users."""
17
18 # TODO paging!
19 c.users = User.query.all()
20
21 return render('/users/index.mako')
22
23 def view(self, name):
24 """Userpage."""
25
26 try:
27 c.this_user = User.query.filter(func.lower(User.name) == name) \
28 .one()
29 except NoResultFound:
30 abort(404)
31
32 return render('/users/view.mako')