本文整理汇总了Python中post.Post.gql方法的典型用法代码示例。如果您正苦于以下问题:Python Post.gql方法的具体用法?Python Post.gql怎么用?Python Post.gql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类post.Post
的用法示例。
在下文中一共展示了Post.gql方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from post import Post [as 别名]
# 或者: from post.Post import gql [as 别名]
def get(self):
secret = self.request.get('secret', None)
if secret is None:
post = Post.gql('ORDER BY secret DESC').get()
secret = post.secret
q = Post.gql('WHERE secret <= :1 ORDER BY secret DESC', secret)
posts = q.fetch(limit=2)
current_post = posts[0]
if len(posts) == 2:
next_secret = posts[1].secret
next_url = '/admin/cleanup?secret=%s' % urllib.quote(next_secret)
else:
next_secret = 'FINISHED'
next_url = '/'
# # model has to be of db.Model type
# if current_post.user is None:
# user = AuthToken(service="twitter", token="dummy")
# user.name = current_post.created_by
# user.url = "http://twitter.com/" + user.name
# user.put()
# current_post.user = user
if hasattr(current_post, 'created_by'):
delattr(current_post, 'created_by')
if hasattr(current_post, 'service'):
delattr(current_post, 'service')
if hasattr(current_post, 'thumbnail_height'):
delattr(current_post, 'thumbnail_height')
current_post.put()
context = {
'current_secret': secret,
'next_secret': next_secret,
'next_url': next_url,
}
self.response.out.write(template.render('cleanup.html', context))