d64d39fa58649740abcac142e30081bfddfd57cf
[zzz-spline-users.git] / spline / plugins / users / controllers / users.py
1 import logging
2
3 from pylons import config, request, response, session, tmpl_context as c, url
4 from pylons.controllers.util import abort, redirect_to
5 from routes import request_config
6 from sqlalchemy.orm.exc import NoResultFound
7
8 from spline import model
9 from spline.model import meta
10 from spline.lib import helpers as h
11 from spline.lib.base import BaseController, render
12
13 log = logging.getLogger(__name__)
14
15 class UsersController(BaseController):
16
17 def index(self):
18 # Return a rendered template
19 # return render('/template.mako')
20 # or, Return a response
21 return 'stub'
22
23 def view(self, id, name=None):
24 """User page.
25
26 URL is /users/id:name, where 'name' only exists for readability and is
27 entirely optional and ignored.
28 """
29
30 c.page_user = meta.Session.query(model.User).get(id)
31 if not c.page_user:
32 abort(404)
33
34 return render('/users/view.mako')