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


Python settings.aslist方法代码示例

本文整理汇总了Python中pyramid.settings.aslist方法的典型用法代码示例。如果您正苦于以下问题:Python settings.aslist方法的具体用法?Python settings.aslist怎么用?Python settings.aslist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyramid.settings的用法示例。


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

示例1: load_settings

# 需要导入模块: from pyramid import settings [as 别名]
# 或者: from pyramid.settings import aslist [as 别名]
def load_settings(registry):
    return Settings(
        swagger12_handler=build_swagger12_handler(
            registry.settings.get('pyramid_swagger.schema12')),
        swagger20_handler=build_swagger20_handler(),
        validate_request=asbool(registry.settings.get(
            'pyramid_swagger.enable_request_validation',
            True,
        )),
        validate_response=asbool(registry.settings.get(
            'pyramid_swagger.enable_response_validation',
            True,
        )),
        validate_path=asbool(registry.settings.get(
            'pyramid_swagger.enable_path_validation',
            True,
        )),
        exclude_paths=get_exclude_paths(registry),
        exclude_routes=set(aslist(registry.settings.get(
            'pyramid_swagger.exclude_routes',
        ) or [])),
        prefer_20_routes=set(aslist(registry.settings.get(
            'pyramid_swagger.prefer_20_routes') or [])),
    ) 
开发者ID:striglia,项目名称:pyramid_swagger,代码行数:26,代码来源:tween.py

示例2: get_swagger_versions

# 需要导入模块: from pyramid import settings [as 别名]
# 或者: from pyramid.settings import aslist [as 别名]
def get_swagger_versions(settings):
    """
    Validates and returns the versions of the Swagger Spec that this pyramid
    application supports.

    :type settings: dict
    :return: list of strings. eg ['1.2', '2.0']
    :raises: ValueError when an unsupported Swagger version is encountered.
    """
    swagger_versions = set(aslist(settings.get(
        'pyramid_swagger.swagger_versions', DEFAULT_SWAGGER_VERSIONS)))

    if len(swagger_versions) == 0:
        raise ValueError('pyramid_swagger.swagger_versions is empty')

    for swagger_version in swagger_versions:
        if swagger_version not in SUPPORTED_SWAGGER_VERSIONS:
            raise ValueError('Swagger version {0} is not supported.'
                             .format(swagger_version))
    return swagger_versions 
开发者ID:striglia,项目名称:pyramid_swagger,代码行数:22,代码来源:tween.py

示例3: _traced_init

# 需要导入模块: from pyramid import settings [as 别名]
# 或者: from pyramid.settings import aslist [as 别名]
def _traced_init(wrapped, instance, args, kwargs):
    settings = kwargs.get("settings", {})
    tweens = aslist(settings.get("pyramid.tweens", []))

    if tweens and TWEEN_NAME not in settings:
        # pyramid.tweens.EXCVIEW is the name of built-in exception view provided by
        # pyramid.  We need our tween to be before it, otherwise unhandled
        # exceptions will be caught before they reach our tween.
        tweens = [TWEEN_NAME] + tweens

        settings["pyramid.tweens"] = "\n".join(tweens)

    kwargs["settings"] = settings

    # `caller_package` works by walking a fixed amount of frames up the stack
    # to find the calling package. So if we let the original `__init__`
    # function call it, our wrapper will mess things up.
    if not kwargs.get("package", None):
        # Get the package for the third frame up from this one.
        # Default is `level=2` which will give us the package from `wrapt`
        # instead of the desired package (the caller)
        kwargs["package"] = caller_package(level=3)

    wrapped(*args, **kwargs)
    instance.include("opentelemetry.ext.pyramid.callbacks") 
开发者ID:open-telemetry,项目名称:opentelemetry-python,代码行数:27,代码来源:__init__.py

示例4: includeme

# 需要导入模块: from pyramid import settings [as 别名]
# 或者: from pyramid.settings import aslist [as 别名]
def includeme(config):
    engine_paths = aslist(config.registry.settings['nefertari.engine'])
    for path in engine_paths:
        config.include(path)
    _load_engines(config)
    main_engine_module = engines[0]
    _import_public_names(main_engine_module)


# replaced by registered engine modules during configuration 
开发者ID:ramses-tech,项目名称:nefertari,代码行数:12,代码来源:engine.py

示例5: _load_engines

# 需要导入模块: from pyramid import settings [as 别名]
# 或者: from pyramid.settings import aslist [as 别名]
def _load_engines(config):
    global engines
    engine_paths = aslist(config.registry.settings['nefertari.engine'])
    engines = tuple([resolve(path) for path in engine_paths]) 
开发者ID:ramses-tech,项目名称:nefertari,代码行数:6,代码来源:engine.py

示例6: get_available_locales

# 需要导入模块: from pyramid import settings [as 别名]
# 或者: from pyramid.settings import aslist [as 别名]
def get_available_locales():
    settings = get_settings()
    return aslist(settings.get('pyramid.available_languages')) 
开发者ID:mazvv,项目名称:travelcrm,代码行数:5,代码来源:common_utils.py

示例7: includeme

# 需要导入模块: from pyramid import settings [as 别名]
# 或者: from pyramid.settings import aslist [as 别名]
def includeme(config):
    """
    Pyramid includeme file for the :class:`pyramid.config.Configurator`
    """

    settings = config.registry.settings

    if 'pyvac.vacation.cp_class.enable' in settings:
        cp_class = asbool(settings['pyvac.vacation.cp_class.enable'])
        if cp_class:
            if 'pyvac.vacation.cp_class.base_file' in settings:
                file = settings['pyvac.vacation.cp_class.base_file']
                CPVacation.initialize(file)

    if 'pyvac.vacation.extra_cp.enable' in settings:
        extra_cp = asbool(settings['pyvac.vacation.extra_cp.enable'])
        if extra_cp:
            CPVacation.extra_cp = True
            if 'pyvac.vacation.extra_cp.cycle_end_year' in settings:
                CPVacation.cycle_end_year = int(settings['pyvac.vacation.extra_cp.cycle_end_year']) # noqa
            if 'pyvac.vacation.extra_cp.cycle_start' in settings:
                date = settings['pyvac.vacation.extra_cp.cycle_start']
                CPVacation.cycle_start = datetime.strptime(date, '%d/%m/%Y')
            if 'pyvac.vacation.extra_cp.delta_restant' in settings:
                CPVacation.delta_restant = int(settings['pyvac.vacation.extra_cp.delta_restant']) # noqa

    if 'pyvac.vacation.cp_lu_class.enable' in settings:
        cp_lu_class = asbool(settings['pyvac.vacation.cp_lu_class.enable'])
        if cp_lu_class:
            if 'pyvac.vacation.cp_lu_class.base_file' in settings:
                file = settings['pyvac.vacation.cp_lu_class.base_file']
                CPLUVacation.initialize(file)

    if 'pyvac.vacation.rtt_class.enable' in settings:
        rtt_class = asbool(settings['pyvac.vacation.rtt_class.enable'])
        if rtt_class:
            if 'pyvac.vacation.rtt_class.except_months' in settings:
                except_months = settings['pyvac.vacation.rtt_class.except_months'] # noqa
                RTTVacation.initialize(aslist(except_months))

    if 'pyvac.firm' in settings:
        User.firm = settings['pyvac.firm']

    if 'pyvac.features.users_flagfile' in settings:
        User.users_flagfile = settings['pyvac.features.users_flagfile']
        User.load_feature_flags()

    if 'pyvac.password.sender.mail' in settings:
        Request.sender_mail = settings['pyvac.password.sender.mail'] 
开发者ID:sayoun,项目名称:pyvac,代码行数:51,代码来源:models.py


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