def askpage(subject, obj, hashkey): post = Post.get_by_key_name(subject + '||' + obj) if post == None: return 'We do not know that!', 404 if post.hashkey != hashkey: return 'You are not authorized' return render_template('index.html', sgender='female', ogender='male', initmethod='EditPost', post=post, title=getTitle(post))
def update(): answer = request.form['answer'] uid = request.form['uid'] hashkey = request.form['hashkey'] post = Post.get_by_key_name(uid) if post and post.hashkey == hashkey: post.answer=answer post.put() return 'ok' return 'fail'
def deletePost(): print request token = request.form['token'] username = request.form['username'] hashkey =request.form['hashkey'] print request.form fb = GraphAPI(token) try: data = fb.get_object("me") print data if username == data['username']: post = Post.get_by_key_name(hashkey) print post if post.created_by == username: post.delete() return 'ok' except:raise print 'here' return ''
def page(subject, obj): post = Post.get_by_key_name(subject + '||' + obj) if post == None: return 'We do not know that!', 404 return render_template('index.html', sgender='female', ogender='male', initmethod='ViewPost', post=post, title=getTitle(post))