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


Python config.update函数代码示例

本文整理汇总了Python中pylons.config.update函数的典型用法代码示例。如果您正苦于以下问题:Python update函数的具体用法?Python update怎么用?Python update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: teardown_class

    def teardown_class(cls):
        plugins.unload('example_idatasetform_v4')
        helpers.reset_db()
        ckan.lib.search.clear_all()

        config.clear()
        config.update(cls.original_config)
开发者ID:6779660,项目名称:ckan,代码行数:7,代码来源:test_example_idatasetform.py

示例2: teardown_class

    def teardown_class(cls):
        config.clear()
        config.update(cls._original_config)
        new_authz.clear_auth_functions_cache()
        PylonsTestCase.teardown_class()

        model.repo.rebuild_db()
开发者ID:1sha1,项目名称:ckan,代码行数:7,代码来源:test_user.py

示例3: make_map

def make_map(config):
    """Create, configure and return the routes Mapper"""
    from pylons import config as c    
    c.update(config)
    from lr.model import LRNode

    map = Mapper(directory=config['pylons.paths']['controllers'],
                 always_scan=config['debug'])
    
    
    def mapResource(config_key, member_name, collection_name):
        try:
            service_doc_id = config[config_key]
            service_doc = h.getServiceDocument(service_doc_id)
            if service_doc is not None and service_doc["active"]:
                map.resource(member_name, collection_name)
                map.connect("/"+collection_name,controller=collection_name,action='options',conditions=dict(method=['OPTIONS']))
                if member_name == 'swordservice':
                    map.connect("/swordpub",controller='swordservice',action='create')
                
                if member_name == 'distribute':
                    map.connect("/destination", controller='distribute', action='destination',
                                          conditions=dict(method='GET'))
                log.info("Enabling service route for: {0} member: {1} collection: {2}".format(service_doc_id, member_name, collection_name))
            else:
                log.info("Service route for {0} is disabled".format(service_doc_id))
        except:
                log.exception("Exception caught: Not enabling service route for config: {0} member: {1} collection: {2}".format(config_key, member_name, collection_name))
            
    
    map.resource('filter', 'filters', controller='contrib/filters', 
        path_prefix='/contrib', name_prefix='contrib_')
    map.resource("register","register")
    mapResource('lr.status.docid', 'status','status')
    mapResource('lr.distribute.docid','distribute','distribute')
    if not LRNode.nodeDescription.gateway_node:
        mapResource('lr.publish.docid', 'publish','publish')
        mapResource('lr.obtain.docid', 'obtain','obtain')        
        mapResource('lr.description.docid', 'description','description')
        mapResource('lr.services.docid', 'services','services')
        mapResource('lr.policy.docid', 'policy','policy')
        mapResource('lr.harvest.docid','harvest','harvest')
        # Value added services
        mapResource('lr.oaipmh.docid', 'OAI-PMH', 'OAI-PMH')
        mapResource('lr.slice.docid', 'slice', 'slice')
        mapResource('lr.sword.docid', 'swordservice','swordservice')    
    map.connect("/extract/{dataservice}/{view}",controller='extract', action='get', list='to-json')
    map.connect("/extract/{dataservice}/{view}/format/{list}",controller='extract', action='get')
    map.minimization = False
    map.explicit = False

    # The ErrorController route (handles 404/500 error pages); it should
    # likely stay at the top, ensuring it can always be resolved
    map.connect('/error/{action}', controller='error')
    map.connect('/error/{action}/{id}', controller='error')
    
    # CUSTOM ROUTES HERE
    map.connect('/{controller}/{action}')
    map.connect('/{controller}/{action}/{id}')
    return map
开发者ID:guywithnose,项目名称:LearningRegistry,代码行数:60,代码来源:routing.py

示例4: teardown_class

 def teardown_class(cls):
     config.clear()
     config.update(cls._original_config)
     model.repo.rebuild_db()
     # Reenable Solr indexing
     if (sys.version_info[0] == 2 and sys.version_info[1] == 6
             and not p.plugin_loaded('synchronous_search')):
         p.load('synchronous_search')
开发者ID:HatemAlSum,项目名称:ckan,代码行数:8,代码来源:test_proxy.py

示例5: wrapper

        def wrapper(*args, **kwargs):
            _original_config = config.copy()
            config[key] = value

            return_value = func(*args, **kwargs)

            config.clear()
            config.update(_original_config)

            return return_value
开发者ID:AAEMCJALBERT,项目名称:ckan,代码行数:10,代码来源:helpers.py

示例6: wrapper

        def wrapper(*args, **kwargs):
            _original_config = config.copy()
            config[key] = value
            new_authz.clear_auth_functions_cache()

            return_value = func(*args, **kwargs)

            config.clear()
            config.update(_original_config)
            new_authz.clear_auth_functions_cache()

            return return_value
开发者ID:BigOpenData,项目名称:ckan,代码行数:12,代码来源:helpers.py

示例7: test_profiles_via_config_option

    def test_profiles_via_config_option(self):

        original_config = config.copy()

        config[RDF_PROFILES_CONFIG_OPTION] = 'profile_conf_1 profile_conf_2'
        try:
            RDFParser()
        except RDFProfileException as e:

            eq_(str(e), 'Unknown RDF profiles: profile_conf_1, profile_conf_2')

        config.clear()
        config.update(original_config)
开发者ID:AQUACROSS,项目名称:ckanext-dcat,代码行数:13,代码来源:test_base_parser.py

示例8: load_environment

def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    
    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='fts3rest', paths=paths)

    config['routes.map'] = make_map(config)
    config['pylons.app_globals'] = app_globals.Globals(config)
    config['pylons.h'] = fts3rest.lib.helpers
    
    # Setup cache object as early as possible
    import pylons
    pylons.cache._push_object(config['pylons.app_globals'].cache)
    
    # If fts3.config is set, load configuration from there
    if config.get('fts3.config'):
        fts3cfg = fts3rest.lib.helpers.fts3_config_load(config.get('fts3.config'))
        config.update(fts3cfg)            

    # Create the Mako TemplateLookup, with the default auto-escaping
    config['pylons.app_globals'].mako_lookup = TemplateLookup(
        directories=paths['templates'],
        error_handler=handle_mako_error,
        module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
        input_encoding='utf-8', default_filters=['escape'],
        imports=['from webhelpers.html import escape'])

    # Setup the SQLAlchemy database engine
    engine = engine_from_config(config, 'sqlalchemy.')
    init_model(engine)

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)
    
    return config
开发者ID:mhellmic,项目名称:fts3,代码行数:44,代码来源:environment.py

示例9: make_map

def make_map(config):
    """Create, configure and return the routes Mapper"""
    from pylons import config as c    
    c.update(config)
    from lr.model import LRNode

    map = Mapper(directory=config['pylons.paths']['controllers'],
                 always_scan=config['debug'])

    map.resource('filter', 'filters', controller='contrib/filters', 
        path_prefix='/contrib', name_prefix='contrib_')
    map.resource('status','status')
    map.resource('distribute','distribute')    
    if not LRNode.nodeDescription.gateway_node:
        map.resource('publish','publish')
        map.resource('obtain','obtain')        
        map.resource('description','description')
        map.resource('services','services')
        map.resource('policy','policy')
        map.resource('harvest','harvest')
        # Value added services
        map.resource('OAI-PMH', 'OAI-PMH')
        map.resource('swordservice','swordservice')
        map.resource('slice', 'slice')
    
    map.minimization = False
    map.explicit = False

    # The ErrorController route (handles 404/500 error pages); it should
    # likely stay at the top, ensuring it can always be resolved
    map.connect('/error/{action}', controller='error')
    map.connect('/error/{action}/{id}', controller='error')

    # CUSTOM ROUTES HERE

    map.connect('/{controller}/{action}')
    map.connect('/{controller}/{action}/{id}')

    return map
开发者ID:nhruska,项目名称:LearningRegistry,代码行数:39,代码来源:routing.py

示例10: make_map

def make_map(config):
    """Create, configure and return the routes Mapper"""
    from pylons import config as c

    c.update(config)
    from lr.model import LRNode

    map = Mapper(directory=config["pylons.paths"]["controllers"], always_scan=config["debug"])

    map.resource("filter", "filters", controller="contrib/filters", path_prefix="/contrib", name_prefix="contrib_")

    map.resource("distribute", "distribute")
    if not LRNode.nodeDescription.gateway_node:
        map.resource("publish", "publish")
        map.resource("obtain", "obtain")
        map.resource("status", "status")
        map.resource("description", "description")
        map.resource("services", "services")
        map.resource("policy", "policy")
        map.resource("harvest", "harvest")
        # Value added services
        map.resource("OAI-PMH", "OAI-PMH")
        map.resource("sword", "sword")
        map.resource("slice", "slices")

    map.minimization = False
    map.explicit = False

    # The ErrorController route (handles 404/500 error pages); it should
    # likely stay at the top, ensuring it can always be resolved
    map.connect("/error/{action}", controller="error")
    map.connect("/error/{action}/{id}", controller="error")

    # CUSTOM ROUTES HERE

    map.connect("/{controller}/{action}")
    map.connect("/{controller}/{action}/{id}")

    return map
开发者ID:lotia,项目名称:LearningRegistry,代码行数:39,代码来源:routing.py

示例11: teardown_class

 def teardown_class(cls):
     # Restore the Pylons config to its original values, in case any tests
     # changed any config settings.
     config.clear()
     config.update(cls._original_config)
开发者ID:AAEMCJALBERT,项目名称:ckan,代码行数:5,代码来源:helpers.py

示例12: teardown_class

 def teardown_class(cls):
     config.clear()
     config.update(cls._original_config)
     CreateTestData.delete()
开发者ID:Accela-Inc,项目名称:ckan,代码行数:4,代码来源:test_storage.py

示例13: teardown_class

 def teardown_class(cls):
     config.clear()
     config.update(cls._original_config)
     plugins.reset()
     create_test_data.CreateTestData.delete()
开发者ID:OpenData-TW,项目名称:ckan,代码行数:5,代码来源:test_preview.py

示例14: teardown_class

 def teardown_class(self):
     config.clear()
     config.update(self._original_config)
     mock_mail_server.SmtpServerHarness.teardown_class()
     pylons_controller.PylonsTestCase.teardown_class()
     model.repo.rebuild_db()
开发者ID:1sha1,项目名称:ckan,代码行数:6,代码来源:test_email_notifications.py

示例15: fake_conf

 def fake_conf(**kwargs):
     from pylons import config
     config = {}
     config['use_gravatar'] = True
     config.update(kwargs)
     return config
开发者ID:adamscieszko,项目名称:rhodecode,代码行数:6,代码来源:test_libs.py


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