Ejemplo n.º 1
0
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']))
Ejemplo n.º 2
0
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 {}