當前位置: 首頁>>代碼示例>>Python>>正文


Python Session.configure方法代碼示例

本文整理匯總了Python中pvscore.model.meta.Session.configure方法的典型用法代碼示例。如果您正苦於以下問題:Python Session.configure方法的具體用法?Python Session.configure怎麽用?Python Session.configure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pvscore.model.meta.Session的用法示例。


在下文中一共展示了Session.configure方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: init_model

# 需要導入模塊: from pvscore.model.meta import Session [as 別名]
# 或者: from pvscore.model.meta.Session import configure [as 別名]
def init_model(engine, settings):
    """
    import os
    app_extension = config['app_conf']['pvs.core.extension']
    extension_root = config['app_conf']['pvs.extension.root.dir']
    if os.path.exists('%s/%s/model' % (extension_root, app_extension)):
        m = '%s.model' % config['app_conf']['pvs.core.extension']
        #print 'load_model(%s)' % m
        exec 'import %s' % m


    from pvscore.lib.plugin import plugin_registry
    for plugin_name in plugin_registry:
        plugin = plugin_registry[plugin_name]
        if os.path.exists(plugin.model_path):
            #print 'load_model(%s)' % plugin.model_package_name
            exec 'import %s' % plugin.model_package_name
    """

    # KB: [2011-09-05]: We make this check because when running under Nose,
    # It nags us that this has already been done.  This just eliminates the nag message.
    if Session.registry and not Session.registry.has():
        psycopg2.extras.register_uuid()
        Session.configure(bind=engine)

    #load everything from the pvs.* keys in the config file into redis
    for setting in settings:
        log.debug('%s = %s' % (setting, settings[setting]))
        if setting.startswith('pvs.'):
            util.cache_set(setting, settings[setting])
開發者ID:anonymoose,項目名稱:pvscore,代碼行數:32,代碼來源:__init__.py


注:本文中的pvscore.model.meta.Session.configure方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。