本文整理汇总了Python中models.Publish.type方法的典型用法代码示例。如果您正苦于以下问题:Python Publish.type方法的具体用法?Python Publish.type怎么用?Python Publish.type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Publish
的用法示例。
在下文中一共展示了Publish.type方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_or_add_publish_entity
# 需要导入模块: from models import Publish [as 别名]
# 或者: from models.Publish import type [as 别名]
def get_or_add_publish_entity(self, source_url):
"""Creates and stores Publish and (if necessary) PublishedPage entities.
Args:
source_url: string
"""
page = PublishedPage.get_or_insert(source_url)
entity = Publish.query(
Publish.status == 'complete', Publish.type != 'preview',
Publish.source == self.source.key,
ancestor=page.key).get()
if entity is None:
entity = Publish(parent=page.key, source=self.source.key)
if self.PREVIEW:
entity.type = 'preview'
entity.put()
logging.debug('Publish entity: %s', entity.key.urlsafe())
return entity
示例2: get_or_add_publish_entity
# 需要导入模块: from models import Publish [as 别名]
# 或者: from models.Publish import type [as 别名]
def get_or_add_publish_entity(self, source_url):
"""Creates and stores :class:`models.Publish` entity.
...and if necessary, :class:`models.PublishedPage` entity.
Args:
source_url: string
"""
page = PublishedPage.get_or_insert(native_str(source_url.encode('utf-8')))
entity = Publish.query(
Publish.status == 'complete', Publish.type != 'preview',
Publish.source == self.source.key,
ancestor=page.key).get()
if entity is None:
entity = Publish(parent=page.key, source=self.source.key)
if self.PREVIEW:
entity.type = 'preview'
entity.put()
logging.debug("Publish entity: '%s'", entity.key.urlsafe())
return entity