本文整理汇总了Python中mygpo.core.models.Podcast.created_timestamp方法的典型用法代码示例。如果您正苦于以下问题:Python Podcast.created_timestamp方法的具体用法?Python Podcast.created_timestamp怎么用?Python Podcast.created_timestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mygpo.core.models.Podcast
的用法示例。
在下文中一共展示了Podcast.created_timestamp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: podcast_for_url
# 需要导入模块: from mygpo.core.models import Podcast [as 别名]
# 或者: from mygpo.core.models.Podcast import created_timestamp [as 别名]
def podcast_for_url(url, create=False):
if not url:
raise QueryParameterMissing('url')
key = 'podcast-by-url-%s' % sha1(url.encode('utf-8')).hexdigest()
podcast = cache.get(key)
if podcast:
return podcast
db = get_main_database()
podcast_group = get_single_result(db, 'podcasts/by_url',
key = url,
include_docs = True,
wrapper = _wrap_pg,
)
if podcast_group:
podcast = podcast_group.get_podcast_by_url(url)
if podcast.needs_update:
incomplete_obj.send_robust(sender=podcast)
else:
cache.set(key, podcast)
return podcast
if create:
podcast = Podcast()
podcast.created_timestamp = get_timestamp(datetime.utcnow())
podcast.urls = [url]
podcast.save()
incomplete_obj.send_robust(sender=podcast)
return podcast
return None