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


Python DatabaseManager.create_cite_ref_from_db方法代码示例

本文整理汇总了Python中database.DatabaseManager.create_cite_ref_from_db方法的典型用法代码示例。如果您正苦于以下问题:Python DatabaseManager.create_cite_ref_from_db方法的具体用法?Python DatabaseManager.create_cite_ref_from_db怎么用?Python DatabaseManager.create_cite_ref_from_db使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在database.DatabaseManager的用法示例。


在下文中一共展示了DatabaseManager.create_cite_ref_from_db方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: citations_all_page

# 需要导入模块: from database import DatabaseManager [as 别名]
# 或者: from database.DatabaseManager import create_cite_ref_from_db [as 别名]
def citations_all_page():
    all_game_cites = [dbm.create_cite_ref_from_db(GAME_CITE_REF, x) for x in dbm.retrieve_all_from_table(dbm.GAME_CITATION_TABLE)]
    all_perf_cites = [dbm.create_cite_ref_from_db(PERF_CITE_REF, x) for x in dbm.retrieve_all_from_table(dbm.PERFORMANCE_CITATION_TABLE)]
    return render_template('citations_main.html',
                           all_game_cites=all_game_cites,
                           all_perf_cites=all_perf_cites,
                           perf_headers=all_perf_cites[0].get_element_names() if all_perf_cites else [],
                           game_headers=all_game_cites[0].get_element_names() if all_game_cites else [])
开发者ID:gamecip,项目名称:citetool-editor,代码行数:10,代码来源:app.py

示例2: process_citation_url

# 需要导入模块: from database import DatabaseManager [as 别名]
# 或者: from database.DatabaseManager import create_cite_ref_from_db [as 别名]
 def process_citation_url():
     while True:
         url = (yield)
         if not dbm.is_attr_in_db('source_url', url, dbm.GAME_CITATION_TABLE):
             click.echo('Extracting url {} through coroutine.'.format(url))
             extractor = get_extractor_for_uri(url, get_url_source(url))
             extractor.extract()
             citation, extracted_options = extractor.create_citation()
             citations.append((citation, NEW))
         else:
             click.echo('Found {} in local db.'.format(url))
             citation = dbm.create_cite_ref_from_db(GAME_CITE_REF,
                                                    dbm.retrieve_attr_from_db(
                                                        'source_url',
                                                        url,
                                                        dbm.GAME_CITATION_TABLE)[0])
             citations.append((citation, OLD))
开发者ID:gamecip,项目名称:citetool-editor,代码行数:19,代码来源:citetool_editor.py

示例3: get_cite_for_uuid

# 需要导入模块: from database import DatabaseManager [as 别名]
# 或者: from database.DatabaseManager import create_cite_ref_from_db [as 别名]
    def get_cite_for_uuid(result):
        ref_type = result['tags']
        uuid = result['uuid']
        if ref_type == GAME_CITE_REF:
            table = dbm.GAME_CITATION_TABLE
        if ref_type == PERF_CITE_REF:
            table = dbm.PERFORMANCE_CITATION_TABLE
        if ref_type == STATE_CITE_REF:
            table = dbm.GAME_SAVE_TABLE

        if ref_type in (GAME_CITE_REF, PERF_CITE_REF):
            db_values = dbm.retrieve_attr_from_db('uuid', uuid, table, limit=1)[0]
            citation = dbm.create_cite_ref_from_db(ref_type, db_values)
        else:
            citation = dbm.retrieve_save_state(uuid=uuid)[0]
            citation['ref_type'] = STATE_CITE_REF
        return citation
开发者ID:gamecip,项目名称:citetool-editor,代码行数:19,代码来源:citetool_editor.py


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