• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python config.update函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: teardown_class

 def teardown_class(cls):
     config.clear()
     config.update(cls._original_config)
     model.repo.rebuild_db()
开发者ID:1sha1,项目名称:ckan,代码行数:4,代码来源:test_proxy.py


示例17: handling

                        help='Make the output more human readable')
    parser.add_argument('-p', '--profile', nargs='*',
                        action='store',
                        help='RDF Profiles to use, defaults to euro_dcat_ap')
    parser.add_argument('-m', '--compat-mode',
                        action='store_true',
                        help='Enable compatibility mode')

    parser.add_argument('-s', '--subcatalogs', action='store_true', dest='subcatalogs',
                        default=False,
                        help="Enable subcatalogs handling (dct:hasPart support)")
    args = parser.parse_args()

    contents = args.file.read()

    config.update({DCAT_EXPOSE_SUBCATALOGS: args.subcatalogs})

    if args.mode == 'produce':
        serializer = RDFSerializer(profiles=args.profile,
                                   compatibility_mode=args.compat_mode)

        dataset = json.loads(contents)
        out = serializer.serialize_dataset(dataset, _format=args.format)
        print out
    else:
        parser = RDFParser(profiles=args.profile,
                           compatibility_mode=args.compat_mode)

        parser.parse(contents, _format=args.format)

        ckan_datasets = [d for d in parser.datasets()]
开发者ID:keitaroinc,项目名称:ckanext-dcat,代码行数:31,代码来源:processors.py


示例18: teardown_class

    def teardown_class(cls):
        model.Session.remove()
        model.repo.rebuild_db()

        config.clear()
        config.update(cls.original_config)
开发者ID:aalecs,项目名称:hdx-ckan-ci,代码行数:6,代码来源:hdx_test_base.py


示例19: teardown_class

 def teardown_class(cls):
     helpers.rebuild_all_dbs(cls.Session)
     p.unload('datastore')
     config.clear()
     config.update(cls._original_config)
开发者ID:Hosting-Scripts,项目名称:ckan,代码行数:5,代码来源:test_dump.py


示例20: 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")
    map.connect("/newauth/", controller="newauth", action="update")
    map.resource("pubkey", "pubkey")
    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}")

    map.resource("auth", "auth")
    return map
开发者ID:MarcNealer,项目名称:LearningRegistry,代码行数:75,代码来源:routing.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python configuration.PylonsConfig类代码示例发布时间:2022-05-25
下一篇:
Python config.init_app函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap