當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。