本文整理汇总了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)
示例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()
示例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
示例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')
示例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
示例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
示例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)
示例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
示例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
示例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
示例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)
示例12: teardown_class
def teardown_class(cls):
config.clear()
config.update(cls._original_config)
CreateTestData.delete()
示例13: teardown_class
def teardown_class(cls):
config.clear()
config.update(cls._original_config)
plugins.reset()
create_test_data.CreateTestData.delete()
示例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()
示例15: fake_conf
def fake_conf(**kwargs):
from pylons import config
config = {}
config['use_gravatar'] = True
config.update(kwargs)
return config