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 {}