Esempio n. 1
0
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))
Esempio n. 2
0
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'
Esempio n. 3
0
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 ''
Esempio n. 4
0
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))