本文整理汇总了Python中model.Post.get_by_key_name方法的典型用法代码示例。如果您正苦于以下问题:Python Post.get_by_key_name方法的具体用法?Python Post.get_by_key_name怎么用?Python Post.get_by_key_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Post
的用法示例。
在下文中一共展示了Post.get_by_key_name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: askpage
# 需要导入模块: from model import Post [as 别名]
# 或者: from model.Post import get_by_key_name [as 别名]
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))
示例2: update
# 需要导入模块: from model import Post [as 别名]
# 或者: from model.Post import get_by_key_name [as 别名]
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'
示例3: deletePost
# 需要导入模块: from model import Post [as 别名]
# 或者: from model.Post import get_by_key_name [as 别名]
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 ''
示例4: page
# 需要导入模块: from model import Post [as 别名]
# 或者: from model.Post import get_by_key_name [as 别名]
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))