Esempio n. 1
0
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 {}
Esempio n. 2
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']))
Esempio n. 3
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 {}
Esempio n. 4
0
def forum_view(request):
    db = DBSession()
    post = db.query(ForumPost).filter(ForumPost.id==request.matchdict['id']).first()
    return {'post': post}
Esempio n. 5
0
def forum_index(request):
    db = DBSession()
    posts = db.query(ForumPost).order_by(ForumPost.post_time)
    return {'posts': posts}
Esempio n. 6
0
def user_index(request):
    db = DBSession()
    people = db.query(Person)
    return {'people': people}
Esempio n. 7
0
def user_view(request):
    db = DBSession()
    person = db.query(Person).filter(Person.id==request.matchdict['id']).first()
    return {'person': person}