back-up commit. probably broken.
[TownSquare.git] / townsquare / controllers / user.py
blob41db736508f2105675923da95b3ed198f065ceba
1 import logging
3 from pylons import request, response, session, tmpl_context as c, app_globals as g
4 from pylons.controllers.util import abort, redirect_to
6 from fma.orm import mapper
7 from townsquare.model.post import Post
8 from townsquare.model.user import User
9 from townsquare.lib.base import BaseController, render
11 log = logging.getLogger(__name__)
13 #mapper(User, Discussion)
15 class UserController(BaseController):
17 def view(self, idname):
18 c.user = g.db.col(User).find_one(idname=idname)
19 wallposts = g.db.col(Post).find(host_classname='User', host_id=c.user._id)
20 order = {'_id':-1}
21 c.user.posts = wallposts.sort(**order)
22 return render('/user/view.mako')
24 def list(self):
25 c.item_list = g.db.col(User).find()
26 return render('/user/list.mako')