当前位置: 首页>>代码示例>>Python>>正文


Python Podcast.wrap方法代码示例

本文整理汇总了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)
开发者ID:fk-lx,项目名称:mygpo,代码行数:9,代码来源:podcast.py

示例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
开发者ID:fk-lx,项目名称:mygpo,代码行数:10,代码来源:podcast.py

示例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)
开发者ID:Mic92,项目名称:mygpo,代码行数:11,代码来源:merge.py

示例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
开发者ID:fk-lx,项目名称:mygpo,代码行数:12,代码来源:podcast.py

示例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)
开发者ID:Mic92,项目名称:mygpo,代码行数:13,代码来源:slugs.py

示例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'])
开发者ID:fk-lx,项目名称:mygpo,代码行数:17,代码来源:podcast.py

示例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
开发者ID:fk-lx,项目名称:mygpo,代码行数:22,代码来源:podcast.py


注:本文中的mygpo.core.models.Podcast.wrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。