本文整理汇总了Python中service.Service.get_by_urlsafe_key方法的典型用法代码示例。如果您正苦于以下问题:Python Service.get_by_urlsafe_key方法的具体用法?Python Service.get_by_urlsafe_key怎么用?Python Service.get_by_urlsafe_key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类service.Service
的用法示例。
在下文中一共展示了Service.get_by_urlsafe_key方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import get_by_urlsafe_key [as 别名]
def update(self, key, form):
entry = Service.get_by_urlsafe_key(key)
if entry.title is not form.title.data:
entry.slug = Service.slugify(entry.title)
entry.title = form.title.data
entry.summary = form.summary.data
entry.post = form.post.data
entry.tags = [Key(urlsafe=tag) for tag in form.tags.data]
return entry.put()
示例2: spam_comment
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import get_by_urlsafe_key [as 别名]
def spam_comment(key):
comment = Service.get_by_urlsafe_key(key)
comment.spam = True
return comment.put
示例3: approve_comment
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import get_by_urlsafe_key [as 别名]
def approve_comment(key):
comment = Service.get_by_urlsafe_key(key)
comment.approved = True
return comment.put()
示例4: get
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import get_by_urlsafe_key [as 别名]
def get(self, key):
return Service.get_by_urlsafe_key(key)
示例5: update
# 需要导入模块: from service import Service [as 别名]
# 或者: from service.Service import get_by_urlsafe_key [as 别名]
def update(self, key, form):
tag = Service.get_by_urlsafe_key(key)
tag.tag = form.tag.data
tag.slug = Service.slugify(form.tag.data)
return tag.put()