本文整理汇总了Python中mygpo.core.models.Podcast.wrap方法的典型用法代码示例。如果您正苦于以下问题:Python Podcast.wrap方法的具体用法?Python Podcast.wrap怎么用?Python Podcast.wrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mygpo.core.models.Podcast
的用法示例。
在下文中一共展示了Podcast.wrap方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _wrap_podcast_group
# 需要导入模块: from mygpo.core.models import Podcast [as 别名]
# 或者: from mygpo.core.models.Podcast import wrap [as 别名]
def _wrap_podcast_group(res):
if res['doc']['doc_type'] == 'Podcast':
return Podcast.wrap(res['doc'])
else:
pg = PodcastGroup.wrap(res['doc'])
id = res['key']
return pg.get_podcast_by_id(id)
示例2: search_wrapper
# 需要导入模块: from mygpo.core.models import Podcast [as 别名]
# 或者: from mygpo.core.models.Podcast import wrap [as 别名]
def search_wrapper(result):
doc = result['doc']
if doc['doc_type'] == 'Podcast':
p = Podcast.wrap(doc)
elif doc['doc_type'] == 'PodcastGroup':
p = PodcastGroup.wrap(doc)
p._id = result['id']
return p
示例3: podcast_url_wrapper
# 需要导入模块: from mygpo.core.models import Podcast [as 别名]
# 或者: from mygpo.core.models.Podcast import wrap [as 别名]
def podcast_url_wrapper(r):
url = r['key']
doc = r['doc']
if doc['doc_type'] == 'Podcast':
obj = Podcast.wrap(doc)
elif doc['doc_type'] == 'PodcastGroup':
obj = PodcastGroup.wrap(doc)
return obj.get_podcast_by_url(url)
示例4: _wrap_podcast_group_key1
# 需要导入模块: from mygpo.core.models import Podcast [as 别名]
# 或者: from mygpo.core.models.Podcast import wrap [as 别名]
def _wrap_podcast_group_key1(res):
obj = res['doc']
if obj['doc_type'] == 'Podcast':
return Podcast.wrap(obj)
else:
pid = res[u'key'][1]
pg = PodcastGroup.wrap(obj)
podcast = pg.get_podcast_by_id(pid)
return podcast
示例5: _podcast_wrapper
# 需要导入模块: from mygpo.core.models import Podcast [as 别名]
# 或者: from mygpo.core.models.Podcast import wrap [as 别名]
def _podcast_wrapper(r):
from mygpo.core.models import Podcast, PodcastGroup
doc = r["doc"]
if doc["doc_type"] == "Podcast":
return Podcast.wrap(doc)
else:
pid = r["key"][2]
pg = PodcastGroup.wrap(doc)
return pg.get_podcast_by_id(pid)
示例6: _wrap_pg
# 需要导入模块: from mygpo.core.models import Podcast [as 别名]
# 或者: from mygpo.core.models.Podcast import wrap [as 别名]
def _wrap_pg(doc):
doc = doc['doc']
if not doc:
return None
if doc['doc_type'] == 'Podcast':
return Podcast.wrap(doc)
elif doc['doc_type'] == 'PodcastGroup':
return PodcastGroup.wrap(doc)
else:
logger.error('received unknown doc_type "%s"', doc['doc_type'])
示例7: all_podcasts
# 需要导入模块: from mygpo.core.models import Podcast [as 别名]
# 或者: from mygpo.core.models.Podcast import wrap [as 别名]
def all_podcasts():
from mygpo.db.couchdb.utils import multi_request_view
res = multi_request_view(Podcast,'podcasts/by_id',
wrap = False,
include_docs = True,
stale = 'update_after',
)
# TODO: this method is only used for maintenance purposes; should we
# really send 'incomplete_obj' signals here?
for r in res:
obj = r['doc']
if obj['doc_type'] == 'Podcast':
yield Podcast.wrap(obj)
else:
pid = r[u'key']
pg = PodcastGroup.wrap(obj)
podcast = pg.get_podcast_by_id(pid)
yield podcast