def user_new(request): if 'action' in request.POST and request.POST['action'] == 'post': db = DBSession() user = Person(request.POST['uname'], request.POST['rname']) db.add(user) db.flush() return HTTPFound(location=request.route_url('user_view', id=user.id)) return {}
def forum_reply(request): db = DBSession() user = require_logged_in(request, db) reply = ForumReply(request.POST['text']) reply.post_id = request.matchdict['post_id'] reply.poster = user db.add(reply) db.flush() return HTTPFound(location=request.route_url('forum_view', id=request.matchdict['post_id']))
def forum_post(request): db = DBSession() user = require_logged_in(request, db) if 'action' in request.POST and request.POST['action'] == 'post': post = ForumPost(request.POST['title'], request.POST['text']) post.poster = user db.add(post) db.flush() return HTTPFound(location=request.route_url('forum_view', id=post.id)) return {}
def forum_view(request): db = DBSession() post = db.query(ForumPost).filter(ForumPost.id==request.matchdict['id']).first() return {'post': post}
def forum_index(request): db = DBSession() posts = db.query(ForumPost).order_by(ForumPost.post_time) return {'posts': posts}
def user_index(request): db = DBSession() people = db.query(Person) return {'people': people}
def user_view(request): db = DBSession() person = db.query(Person).filter(Person.id==request.matchdict['id']).first() return {'person': person}