Beispiel #1
0
def add(rq):
    user = current_user(rq)
    d = rq.form()
    d['user_id'] = user.id
    t = Tweet(d)
    t.add()
    return redirect('/tweet')
def add(rq):
    user = current_user(rq)
    d = rq.form()
    d['tweet_id'] = int(rq.query['id'])
    d['user_id'] = user.id
    t = Comment(d)
    t.add()
    return redirect('/tweet')
def index(rq):
    user = current_user(rq)
    if user is None:
        username = '******'
    else:
        username = user.username
    body = template(env, 'index.html', username=username)
    response_msg = make_response_msg(body=body)
    return response_msg
Beispiel #4
0
 def wrapper(rq):
     tweet_id = int(rq.query.get('id', -1))
     t = Tweet.find(tweet_id)
     user = current_user(rq)
     if t is not None and t.user_id == user.id:
         response_msg = route_func(rq)
     else:
         response_msg = redirect('/login')
     return response_msg
 def wrapper(rq):
     cmt_id = int(rq.query.get('id', -1))
     cmt = Comment.find(cmt_id)
     user = current_user(rq)
     if cmt is not None and cmt.user_id == user.id:
         response_msg = route_func(rq)
     else:
         response_msg = redirect('/login')
     return response_msg
Beispiel #6
0
def index(rq):
    user = current_user(rq)
    if user is None:
        username = '******'
    else:
        username = user.username
    tweets = Tweet.get_all()
    body = template(env, 'index.html', username=username, tweets=tweets)
    response_msg = make_response_msg(body=body)
    return response_msg