本文整理汇总了Python中pyramid.settings.asbool函数的典型用法代码示例。如果您正苦于以下问题:Python asbool函数的具体用法?Python asbool怎么用?Python asbool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了asbool函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: includeme
def includeme(config):
"""Bind to the db engine specifed in ``config.registry.settings``.
Setup::
>>> from mock import Mock
>>> import pyramid_basemodel
>>> _engine_from_config = pyramid_basemodel.engine_from_config
>>> _bind_engine = pyramid_basemodel.bind_engine
>>> pyramid_basemodel.engine_from_config = Mock()
>>> pyramid_basemodel.engine_from_config.return_value = 'engine'
>>> pyramid_basemodel.bind_engine = Mock()
>>> mock_config = Mock()
>>> mock_config.registry.settings = {}
Calls ``bind_engine`` with the configured ``engine``::
>>> includeme(mock_config)
>>> pyramid_basemodel.bind_engine.assert_called_with('engine',
... should_create=True, should_drop=False)
Teardown::
>>> pyramid_basemodel.engine_from_config = _engine_from_config
>>> pyramid_basemodel.bind_engine = _bind_engine
"""
# Bind the engine.
settings = config.registry.settings
engine = engine_from_config(settings, 'sqlalchemy.')
should_create = asbool(settings.get('basemodel.should_create_all', True))
should_drop = asbool(settings.get('basemodel.should_drop_all', False))
bind_engine(engine, should_create=should_create, should_drop=should_drop)
开发者ID:vickyi,项目名称:pyramid_basemodel,代码行数:34,代码来源:__init__.py
示例2: includeme
def includeme(config):
"""Configure basic REST settings for a Pyramid application.
You should not call this function directly, but use
:py:func:`pyramid.config.Configurator.include` to initialise
the REST toolkit.
.. code-block:: python
:linenos:
config = Configurator()
config.include('rest_toolkit')
"""
settings = config.registry.settings
settings['rest_toolkit.debug'] = \
settings.get('debug_all') or \
settings.get('pyramid.debug_all') or \
settings.get('rest_toolkit.debug') or \
asbool(os.environ.get('PYRAMID_DEBUG_ALL')) or \
asbool(os.environ.get('REST_TOOLKIT_DEBUG'))
if not settings['rest_toolkit.debug']:
config.add_view('rest_toolkit.error.generic',
context=Exception, renderer='json',
permission=NO_PERMISSION_REQUIRED)
config.add_view('rest_toolkit.error.http_error', context=IExceptionResponse, renderer='json')
config.add_view('rest_toolkit.error.http_error', context=WSGIHTTPException, renderer='json')
config.add_notfound_view('rest_toolkit.error.notfound', renderer='json')
config.add_forbidden_view('rest_toolkit.error.forbidden', renderer='json')
开发者ID:seattle,项目名称:rest_toolkit,代码行数:28,代码来源:__init__.py
示例3: setup_app
def setup_app(registry, ini_location):
loader = INILoader(celery_app, ini_file=ini_location)
celery_config = loader.read_configuration()
#: TODO: There might be other variables requiring special handling
boolify(celery_config, 'CELERY_ALWAYS_EAGER', 'CELERY_ENABLE_UTC', 'CELERY_RESULT_PERSISTENT')
if asbool(celery_config.get('USE_CELERYCONFIG', False)) is True:
config_path = 'celeryconfig'
celery_app.config_from_object(config_path)
else:
# TODO: Couldn't find a way with celery to do this
hijack_logger = asbool(
celery_config.get('CELERYD_HIJACK_ROOT_LOGGER', False)
)
celery_config['CELERYD_HIJACK_ROOT_LOGGER'] = hijack_logger
if hijack_logger is False:
global ini_file
ini_file = ini_location
signals.setup_logging.connect(configure_logging)
celery_app.config_from_object(celery_config)
celery_app.conf.update({'PYRAMID_REGISTRY': registry})
开发者ID:websauna,项目名称:pyramid_celery,代码行数:26,代码来源:__init__.py
示例4: includeme
def includeme(config):
"""
RPC loader for Pyramid
"""
global _do_xmlrpc, _do_jsonrpc
cfg = config.registry.settings
_do_xmlrpc = asbool(cfg.get('netprofile.rpc.xmlrpc', True))
_do_jsonrpc = asbool(cfg.get('netprofile.rpc.jsonrpc', True))
if _do_xmlrpc:
config.include('pyramid_rpc.xmlrpc')
config.add_xmlrpc_endpoint('api.xmlrpc', '/api/xmlrpc')
if _do_jsonrpc:
config.include('pyramid_rpc.jsonrpc')
renderer = JSON()
def _json_datetime(obj, req):
if obj.tzinfo is None:
obj = obj.replace(tzinfo=tzlocal())
return obj.isoformat()
renderer.add_adapter(dt.datetime, _json_datetime)
renderer.add_adapter(dt.date, lambda obj, req: obj.isoformat())
renderer.add_adapter(dt.time, lambda obj, req: obj.isoformat())
renderer.add_adapter(ipaddress.IPv4Address, lambda obj, req: int(obj))
renderer.add_adapter(decimal.Decimal, lambda obj, req: str(obj))
config.add_renderer('jsonrpc', renderer)
config.add_jsonrpc_endpoint('api.jsonrpc', '/api/jsonrpc',
default_renderer='jsonrpc')
config.scan()
开发者ID:unikmhz,项目名称:npui,代码行数:31,代码来源:rpc.py
示例5: get_global_base_url
def get_global_base_url(require_secure=None, override_port=None):
"""Get the base URL of this server
DO NOT USE directly, except for Linked data;
use Discussion.get_base_url()
"""
port = str(override_port or config.get('public_port'))
accept_secure_connection = asbool(
config.get('accept_secure_connection'))
require_secure_connection = accept_secure_connection and (require_secure or asbool(
config.get('require_secure_connection')))
service = 'http'
portString = ''
if accept_secure_connection or require_secure_connection:
if port is None or port == "443":
service += 's'
elif port == "80":
if require_secure_connection:
service += 's' # assume standard port upgrade
else:
if require_secure_connection:
service += 's'
portString = (':'+port)
else:
if port is not None and port != "80":
portString = (':'+port)
return '%s://%s%s' % (
service, config.get('public_hostname'), portString)
开发者ID:kamyarrasta,项目名称:assembl,代码行数:27,代码来源:utils.py
示例6: client_activate
def client_activate(request):
if authenticated_userid(request):
return HTTPSeeOther(location=request.route_url('access.cl.home'))
did_fail = True
cur_locale = locale_neg(request)
cfg = request.registry.settings
comb_js = asbool(cfg.get('netprofile.client.combine_js', False))
can_reg = asbool(cfg.get('netprofile.client.registration.enabled', False))
must_verify = asbool(cfg.get('netprofile.client.registration.verify_email', True))
link_id = int(cfg.get('netprofile.client.registration.link_id', 1))
rand_len = int(cfg.get('netprofile.client.registration.code_length', 20))
if (not can_reg) or (not must_verify):
return HTTPSeeOther(location=request.route_url('access.cl.login'))
code = request.GET.get('code', '').strip().upper()
login = request.GET.get('for', '')
if code and login and (len(code) == rand_len):
sess = DBSession()
for link in sess.query(AccessEntityLink)\
.options(joinedload(AccessEntityLink.entity))\
.filter(AccessEntityLink.type_id == link_id, AccessEntityLink.value == code):
# TODO: implement code timeouts
ent = link.entity
if (ent.access_state == AccessState.block_inactive.value) and (ent.nick == login):
ent.access_state = AccessState.ok.value
sess.delete(link)
did_fail = False
break
tpldef = {
'failed' : did_fail,
'comb_js' : comb_js,
'cur_loc' : cur_locale
}
request.run_hook('access.cl.tpldef.activate', tpldef, request)
return tpldef
开发者ID:baloon11,项目名称:npui,代码行数:34,代码来源:views.py
示例7: __init__
def __init__(self, context, request):
self.context = context
self.request = request
self.version = __version__
self.home_url = request.application_url
self.help_url = request.registry.settings.get('help.url')
self.support_url = request.registry.settings.get('support.url') or "http://support.eucalyptus.com"
self.aws_enabled = asbool(request.registry.settings.get('aws.enabled'))
self.aws_regions = AWS_REGIONS
self.default_region = request.registry.settings.get('aws.default.region')
self.browser_password_save = 'true' if asbool(request.registry.settings.get('browser.password.save')) else 'false'
self.cloud_type = request.session.get('cloud_type')
self.selected_region = self.request.session.get('region', self.default_region)
self.selected_region_label = self.get_selected_region_label(self.selected_region)
self.username = self.request.session.get('username')
self.account = self.request.session.get('account')
self.username_label = self.request.session.get('username_label')
self.euca_logout_form = EucaLogoutForm(request=self.request)
self.date_format = _(u'%I:%M:%S %p %b %d %Y')
self.angular_date_format = _(u'hh:mm:ss a MMM d yyyy')
self.tag_pattern_key = '^(?!aws:).{0,128}$'
self.tag_pattern_value = '^(?!aws:).{0,256}$'
self.integer_gt_zero_pattern = '^[1-9]\d*$'
self.non_negative_pattern = '^[0-9]\d*$'
self.cidr_pattern = '{0}{1}'.format(
'^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}',
'(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(\/\d+)$'
)
self.querystring = self.get_query_string()
self.help_html_dir = 'eucaconsole:static/html/help/'
开发者ID:eucalyptus-ja,项目名称:eucaconsole,代码行数:30,代码来源:layout.py
示例8: authenticate_user
def authenticate_user(self, user: IUser, login_source:str, location: str=None):
"""Make the current session logged in session for this particular user."""
request = self.request
settings = request.registry.settings
require_activation = asbool(settings.get('horus.require_activation', True))
allow_inactive_login = asbool(settings.get('horus.allow_inactive_login', False))
if (not allow_inactive_login) and require_activation and (not user.is_activated()):
raise AuthenticationFailure('Your account is not active, please check your e-mail. If your account activation email as expired please request a password reset.')
if not user.can_login():
raise AuthenticationFailure('This user account cannot log in at the moment.')
user_registry = get_user_registry(request)
token = user_registry.get_session_token(user)
headers = remember(request, token)
# assert headers, "Authentication backend did not give us any session headers"
if not location:
location = get_config_route(request, 'horus.login_redirect')
self.greet_user(user)
self.update_login_data(user)
e = events.Login(request, user)
request.registry.notify(e)
return HTTPFound(location=location, headers=headers)
开发者ID:agronholm,项目名称:websauna,代码行数:30,代码来源:loginservice.py
示例9: rewrite
def rewrite(self, session=None, skip_rollback=True, deferred=True,
start=False):
self.check_initialized()
session = session or Session.object_session(self)
if not session:
raise DetachedInstanceError()
self.log.info("Rewriting configuration for %s", self)
if asbool(self.settings.get('supervisor.enabled')):
pfx = self.settings.get('supervisor.command.prefix', 'aybu')
session.activity_log.add(render, 'supervisor.conf.mako',
self.paths.configs.supervisor_conf,
env=self, uwsgi=self.uwsgi_config,
program_prefix=pfx,
skip_rollback=skip_rollback,
deferred=deferred)
self.update_supervisor_conf(session)
elif asbool(self.settings.get('upstart.enabled')):
self.log.info("rendering %s", self.paths.configs.upstart_conf)
session.activity_log.add(render, 'upstart.conf.mako',
self.paths.configs.upstart_conf,
env=self, uwsgi=self.uwsgi_config,
skip_rollback=skip_rollback,
deferred=deferred)
action = "start" if start else "restart"
self.update_upstart(session, action)
开发者ID:asidev,项目名称:aybu-manager,代码行数:28,代码来源:environment.py
示例10: set_config_types
def set_config_types(config):
"""
convert raw config values to proper types
:param config:
:return:
"""
config = copy.deepcopy(config)
config["debug"] = asbool(config["debug"])
config["port"] = int(config["port"])
config["validate_requests"] = asbool(config["validate_requests"])
config["enforce_https"] = asbool(config["enforce_https"])
if not config["cookie_secret"]:
config["cookie_secret"] = str(uuid.uuid4())
if config["http_scheme"] not in ["http", "https"]:
config["http_scheme"] = ""
for key in ["allow_posting_from", "allow_cors"]:
if not config[key]:
continue
# if those keys are strings from ini convert to lists of individual values
if isinstance(config[key], str):
try:
listed = [ip.strip() for ip in config[key].split(",") if ip.strip()]
config[key] = listed
except ValueError:
pass
return config
开发者ID:AppEnlight,项目名称:channelstream,代码行数:28,代码来源:utils.py
示例11: main
def main(global_config, **settings):
settings = dict(global_config, **settings)
settings.setdefault('jinja2.i18n.domain', 'CheesePrism')
session_factory = UnencryptedCookieSessionFactoryConfig('cheeseprism')
config = Configurator(root_factory=App, settings=settings,
session_factory=session_factory,
authentication_policy=\
BasicAuthenticationPolicy(BasicAuthenticationPolicy.noop_check))
setup_workers(config.registry)
config.add_translation_dirs('locale/')
config.include('.request')
config.include('.views')
config.include('.index')
tempspec = settings.get('cheeseprism.index_templates', '')
config.registry['cp.index_templates'] = EnvFactory.from_str(tempspec)
if asbool(settings.get('cheeseprism.pipcache_mirror', False)):
config.include('.sync.pip')
if asbool(settings.get('cheeseprism.auto_sync', False)):
config.include('.sync.auto')
tempfile_limit = int(settings.get('cheeseprism.temp_file_limit', 10*1024))
config.add_request_method(lambda req: tempfile_limit,
name='request_body_tempfile_limit', reify=True)
config.add_request_method(lambda req: asbool(settings.get('cheeseprism.disable.regenerate', False)),
name='disable_regen', reify=True)
return config.make_wsgi_app()
开发者ID:msabramo,项目名称:CheesePrism,代码行数:35,代码来源:wsgiapp.py
示例12: __init__
def __init__(self, registry):
self.es = registry[ELASTIC_SEARCH]
self.esstorage = registry[STORAGE]
self.index = registry.settings['snovault.elasticsearch.index']
self.queue_server = None
self.queue_worker = None
self.worker_runs = []
available_queues = registry['available_queues']
queue_type = registry.settings.get('queue_type', None)
is_queue_server = asbool(registry.settings.get('queue_server'))
is_queue_worker = asbool(registry.settings.get('queue_worker'))
queue_worker_processes = int(
registry.settings.get('queue_worker_processes', 1)
)
queue_worker_chunk_size = int(
registry.settings.get('queue_worker_chunk_size', 1024)
)
queue_worker_batch_size = int(
registry.settings.get('queue_worker_batch_size', 1024)
)
queue_options = {
'processes': queue_worker_processes,
'chunk_size': queue_worker_chunk_size,
'batch_size': queue_worker_batch_size,
}
if is_queue_server and queue_type in available_queues:
if not queue_type or queue_type == 'Simple':
self.queue_server = SimpleUuidServer(queue_options)
else:
log.error('No queue available for Indexer')
if self.queue_server and is_queue_worker:
self.queue_worker = self.queue_server.get_worker()
开发者ID:lrowe,项目名称:snovault,代码行数:32,代码来源:indexer.py
示例13: configure
def configure(cls, settings):
kwargs = super(LDAPAccessBackend, cls).configure(settings)
conn = LDAP(
admin_field=settings.get("auth.ldap.admin_field"),
admin_group_dn=settings.get("auth.ldap.admin_group_dn"),
admin_value=aslist(
settings.get("auth.ldap.admin_value", []), flatten=False
),
base_dn=settings.get("auth.ldap.base_dn"),
cache_time=settings.get("auth.ldap.cache_time"),
service_dn=settings.get("auth.ldap.service_dn"),
service_password=settings.get("auth.ldap.service_password", ""),
service_username=settings.get("auth.ldap.service_username"),
url=settings["auth.ldap.url"],
user_dn_format=settings.get("auth.ldap.user_dn_format"),
user_search_filter=settings.get("auth.ldap.user_search_filter"),
ignore_cert=asbool(settings.get("auth.ldap.ignore_cert")),
ignore_referrals=asbool(settings.get("auth.ldap.ignore_referrals", False)),
ignore_multiple_results=asbool(
settings.get("auth.ldap.ignore_multiple_results", False)
),
)
conn.connect()
kwargs["conn"] = conn
fallback = settings.get("auth.ldap.fallback")
if fallback == "config":
kw = ConfigAccessBackend.configure(settings)
kwargs["fallback_factory"] = lambda r: ConfigAccessBackend(r, **kw)
return kwargs
开发者ID:mathcamp,项目名称:pypicloud,代码行数:31,代码来源:ldap_.py
示例14: __init__
def __init__(self, request):
super(AuthController, self).__init__(request)
schema = request.registry.getUtility(ILoginSchema)
self.schema = schema().bind(request=self.request)
form = request.registry.getUtility(ILoginForm)
self.login_redirect_view = get_config_route(
request,
'horus.login_redirect'
)
self.logout_redirect_view = get_config_route(
request,
'horus.logout_redirect'
)
self.require_activation = asbool(
self.settings.get('horus.require_activation', True)
)
self.allow_inactive_login = asbool(
self.settings.get('horus.allow_inactive_login', False)
)
# XXX: Bootstrap classes leak into Deform here
login_button = deform.Button(name="login_email", title="Login with email", css_class="btn-lg btn-block")
self.form = form(self.schema, buttons=(login_button,))
# If the form is embedded on other pages force it go to right HTTP POST endpoint
self.form.action = request.route_url("login")
开发者ID:rmoorman,项目名称:websauna,代码行数:31,代码来源:views.py
示例15: load
def load(self, settings, prefix):
d = {key[len(prefix):]: value
for key, value in settings.items()
if key.startswith(prefix)}
self.sitename = d.get('sitename', 'PizzaVolus')
footer_file = d.get('footer_file')
if footer_file:
with open(footer_file) as f:
self.footer_text = f.read()
else:
self.footer_text = d.get('footer_text')
self.log_user_auth = asbool(d.get('log_user_auth', True))
self.log_address_auth = asbool(d.get('log_address_auth', False))
self.user_log_limit = int(d.get('user_log_limit', 10))
self.address_log_limit = int(d.get('address_log_limit', 5))
default_recaptcha_api = 'https://www.google.com/recaptcha/api/siteverify'
self.recaptcha_site = d.get('recaptcha_site')
self.recaptcha_secret = d.get('recaptcha_secret')
self.recaptcha_api = d.get('recaptcha_api', default_recaptcha_api)
self.use_recaptcha = self.recaptcha_secret and self.recaptcha_site
# Required level to see logs.
# "address" < "user" < other values (disable log access)
self.address_log_access = d.get('address_log_access', 'user')
self.user_log_access = d.get('user_log_access', 'user')
# Default local name regexp
self.lname_pattern = d.get('lname_pattern', '^[a-zA-Z0-9_.-]{3,64}$')
开发者ID:DavePS,项目名称:PizzaVolus,代码行数:33,代码来源:__init__.py
示例16: __init__
def __init__(self, request):
super(AuthController, self).__init__(request)
schema = request.registry.getUtility(ILoginSchema)
self.schema = schema().bind(request=self.request)
form = request.registry.getUtility(ILoginForm)
self.login_redirect_view = get_config_route(
request,
'horus.login_redirect'
)
self.logout_redirect_view = get_config_route(
request,
'horus.logout_redirect'
)
self.require_activation = asbool(
self.settings.get('horus.require_activation', True)
)
self.allow_inactive_login = asbool(
self.settings.get('horus.allow_inactive_login', False)
)
self.form = form(self.schema, buttons=(self.Str.login_button,))
开发者ID:ajkaanbal,项目名称:horus,代码行数:25,代码来源:__init__.py
示例17: main
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
config = Configurator(settings=settings)
# add html renderer (chameleon based)
config.add_renderer(name='.html', factory='p_started.renderer.AppDistRendererFactory')
production_config = asbool(settings.get('PRODUCTION', 'false'))
production_config = asbool(settings.get('PRODUCTION', 'false'))
production = os.environ.get('PRODUCTION', production_config)
minify_config = settings.get('minify', 'app')
minify = os.environ.get('minify', minify_config)
config.include('pyramid_chameleon')
# static views
# See also config.override_asset if you want to avoid minify
config.add_static_view('scripts', 'p_started:webapp/%s/scripts' % minify, cache_max_age=3600)
config.add_static_view('styles', 'p_started:webapp/%s/styles' % minify, cache_max_age=3600)
config.add_static_view('images', 'p_started:webapp/%s/images' % minify, cache_max_age=3600)
if not production:
# we expose the bower_components dir just for development deployments, not good for production
config.add_static_view('bower_components', 'p_started:webapp/%s/bower_components' % minify, cache_max_age=3600)
else:
config.add_static_view('fonts', 'p_started:webapp/%s/fonts' % minify, cache_max_age=3600)
# routes
config.add_route('home', '/')
config.scan()
return config.make_wsgi_app()
开发者ID:davidemoro,项目名称:p_started,代码行数:31,代码来源:__init__.py
示例18: includeme
def includeme(config):
DEFAULT = {
'versions': '3.0.3',
'use_min_file': True,
'use_cdn': False,
'static_path': {
'cdn': "//netdna.bootstrapcdn.com/bootstrap/",
'local': 'bootstrap/'
},
'cache_max_age': 3600,
}
settings = config.get_settings()
setting_prefix = "bootstrap."
def get_setting(attr, default=None):
return settings.get(setting_prefix + attr, default)
versions = get_setting('versions', DEFAULT['versions'])
use_min_file = asbool(get_setting("use_min_file", DEFAULT['use_min_file']))
bootstraps = BootstrapFactory.build_bootstraps(versions, use_min_file)
use_cdn = asbool(get_setting("use_cdn"))
if use_cdn:
static_path = DEFAULT['static_path']['cdn']
else:
static_path = get_setting('static_path',
DEFAULT['static_path']['local'])
cache_max_age = get_setting('cache_max_age', DEFAULT['cache_max_age'])
for version in bootstraps:
config.add_static_view(static_path + version,
"pyramid_bootstrap:static/{}".format(version),
cache_max_age=cache_max_age)
config.scan('pyramid_bootstrap.event_subscribers')
开发者ID:ceelian,项目名称:pyramid_bootstrap,代码行数:35,代码来源:__init__.py
示例19: set_status
def set_status(self, new_status, request, parent=True):
root = find_root(self)
schema = self.type_info.schema
properties = self.upgrade_properties()
item_id = '{}/'.format(resource_path(self))
current_status = properties.get('status')
if not current_status:
raise ValidationFailure('body', ['status'], 'No property status')
if not self._valid_status(new_status, schema, parent):
return False
force_transition = asbool(request.params.get('force_transition'))
if not self._valid_transition(current_status, new_status, parent, force_transition):
return False
force_audit = asbool(request.params.get('force_audit'))
self._block_on_audits(item_id, force_audit, request, parent, new_status)
update = asbool(request.params.get('update'))
self._update_status(new_status, current_status, properties, schema, request, item_id, update)
request._set_status_considered_paths.add((item_id, current_status, new_status))
logging.warn(
'Considering {} from status {} to status {}'.format(item_id, current_status, new_status)
)
block_children = self._calculate_block_children(request, force_transition)
child_paths = self._get_child_paths(current_status, new_status, block_children)
embedded_properties = request.embed(item_id, '@@embedded')
related_objects = self._get_related_object(child_paths, embedded_properties, request)
self._set_status_on_related_objects(new_status, related_objects, root, request)
return True
开发者ID:ENCODE-DCC,项目名称:encoded,代码行数:27,代码来源:base.py
示例20: test_analytics_full_config
def test_analytics_full_config(self):
import analytics
parser = self.get_parser()
self.setup_logging(parser)
settings = dict(parser.items('app:testapp'))
config = testing.setUp(settings=settings)
config.include('pyramid_analytics')
# Check config
self.assertEqual(analytics.default_client.secret,
settings['analytics.secret'])
self.assertEqual(analytics.default_client.flush_at,
int(settings['analytics.flush_at']))
self.assertEqual(analytics.default_client.flush_after.seconds,
int(settings['analytics.flush_after']))
self.assertEqual(analytics.default_client.async,
asbool(settings['analytics.async']))
self.assertEqual(analytics.default_client.send,
asbool(settings['analytics.send']))
self.assertEqual(analytics.default_client.max_queue_size,
int(settings['analytics.max_queue_size']))
# Check logging
log_config = dict(parser.items('logger_analytics'))
analytics_logger = logging.getLogger(log_config['qualname'])
self.assertEqual(analytics_logger.propagate,
int(log_config['propagate']))
self.assertEqual(analytics_logger.level,
getattr(logging, log_config['level']))
开发者ID:dfee,项目名称:pyramid_analytics,代码行数:30,代码来源:tests.py
注:本文中的pyramid.settings.asbool函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论