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


Python cors.set_defaults方法代码示例

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


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

示例1: set_cors_middleware_defaults

# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_cors_middleware_defaults():
    """Update default configuration options for oslo.middleware."""
    cors.set_defaults(
        allow_headers=['X-Auth-Token',
                       'X-Identity-Status',
                       'X-Roles',
                       'X-Service-Catalog',
                       'X-User-Id',
                       'X-Project-Id',
                       'X-OpenStack-Request-ID',
                       'X-Server-Management-Url'],
        expose_headers=['X-Auth-Token',
                        'X-Subject-Token',
                        'X-Service-Token',
                        'X-OpenStack-Request-ID',
                        'X-Server-Management-Url'],
        allow_methods=['GET',
                       'PUT',
                       'POST',
                       'DELETE',
                       'PATCH']) 
开发者ID:openstack,项目名称:zun,代码行数:23,代码来源:config.py

示例2: set_defaults

# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_defaults():
    """Override all default values from upstream packages"""

    cors.set_defaults(
        allow_headers=['X-Auth-Token',
                       'X-Auth-Sudo-Tenant-ID',
                       'X-Auth-Sudo-Project-ID',
                       'X-Auth-All-Projects',
                       'X-Designate-Edit-Managed-Records',
                       'OpenStack-DNS-Hide-Counts'],
        expose_headers=['X-OpenStack-Request-ID',
                        'Host'],
        allow_methods=['GET',
                       'PUT',
                       'POST',
                       'DELETE',
                       'PATCH',
                       'HEAD']
    ) 
开发者ID:openstack,项目名称:designate,代码行数:21,代码来源:config.py

示例3: set_cors_middleware_defaults

# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_cors_middleware_defaults():
    """Update default configuration options for oslo.middleware."""
    cors.set_defaults(
        allow_headers=['X-Auth-Token',
                       'X-Identity-Status',
                       'X-Roles',
                       'X-Service-Catalog',
                       'X-User-Id',
                       'X-Tenant-Id',
                       'X-OpenStack-Request-ID',
                       'X-Server-Management-Url'],
        expose_headers=['X-Auth-Token',
                        'X-Subject-Token',
                        'X-Service-Token',
                        'X-OpenStack-Request-ID',
                        'X-Server-Management-Url'],
        allow_methods=['GET',
                       'PUT',
                       'POST',
                       'DELETE',
                       'PATCH']
    ) 
开发者ID:openstack,项目名称:magnum,代码行数:24,代码来源:config.py

示例4: set_middleware_defaults

# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_middleware_defaults():
    """Update default configuration options for oslo.middleware."""
    cors.set_defaults(
        allow_headers=['X-Auth-Token',
                       'X-OpenStack-Request-ID',
                       'X-Openstack-Manila-Api-Version',
                       'X-OpenStack-Manila-API-Experimental',
                       'X-Identity-Status',
                       'X-Roles',
                       'X-Service-Catalog',
                       'X-User-Id',
                       'X-Tenant-Id'],
        expose_headers=['X-Auth-Token',
                        'X-OpenStack-Request-ID',
                        'X-Openstack-Manila-Api-Version',
                        'X-OpenStack-Manila-API-Experimental',
                        'X-Subject-Token',
                        'X-Service-Token'],
        allow_methods=['GET',
                       'PUT',
                       'POST',
                       'DELETE',
                       'PATCH']
    ) 
开发者ID:openstack,项目名称:manila,代码行数:26,代码来源:config.py

示例5: set_cors_middleware_defaults

# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_cors_middleware_defaults():
    """Update default configuration options for oslo.middleware."""
    cors.set_defaults(
        allow_headers=['X-Auth-Token',
                       'X-Subject-Token',
                       'X-Roles',
                       'X-User-Id',
                       'X-Domain-Id',
                       'X-Project-Id',
                       'X-Tenant-Id',
                       'X-OpenStack-Request-ID'],
        expose_headers=['X-Auth-Token',
                        'X-Subject-Token',
                        'X-Service-Token',
                        'X-OpenStack-Request-ID'],
        allow_methods=['GET',
                       'PUT',
                       'POST',
                       'DELETE',
                       'PATCH']) 
开发者ID:openstack,项目名称:cloudkitty,代码行数:22,代码来源:defaults.py

示例6: set_config_defaults

# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_config_defaults():
    """Update default configuration options for oslo.middleware."""
    cors.set_defaults(
        allow_headers=['X-Auth-Token',
                       'X-Identity-Status',
                       'X-Roles',
                       'X-Service-Catalog',
                       'X-User-Id',
                       'X-Tenant-Id',
                       'X-OpenStack-Request-ID'],
        expose_headers=['X-Auth-Token',
                        'X-Subject-Token',
                        'X-Service-Token',
                        'X-OpenStack-Request-ID'],
        allow_methods=['GET',
                       'PUT',
                       'POST',
                       'DELETE',
                       'PATCH']) 
开发者ID:openstack,项目名称:senlin,代码行数:21,代码来源:config.py

示例7: set_cors_middleware_defaults

# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_cors_middleware_defaults():
    """Update default configuration options for oslo.middleware."""
    cors.set_defaults(
        allow_headers=['X-Auth-Token',
                       'X-Identity-Status',
                       'X-Roles',
                       'X-Service-Catalog',
                       'X-User-Id',
                       'X-Tenant-Id',
                       'X-Project-Id',
                       'X-User-Name',
                       'X-Project-Name'],
        allow_methods=['GET',
                       'PUT',
                       'POST',
                       'DELETE',
                       'PATCH'],
        expose_headers=['X-Auth-Token',
                        'X-Subject-Token',
                        'X-Service-Token',
                        'X-Project-Id',
                        'X-User-Name',
                        'X-Project-Name']
    ) 
开发者ID:openstack,项目名称:qinling,代码行数:26,代码来源:config.py

示例8: parse_args

# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def parse_args(argv, default_config_files=None):
    rpc.set_defaults(control_exchange='zun')
    init(argv[1:], default_config_files=default_config_files)
    rpc.init(zun.conf.CONF) 
开发者ID:openstack,项目名称:zun,代码行数:6,代码来源:config.py

示例9: _wrap_app

# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def _wrap_app(app):
    """Wraps wsgi app with additional middlewares."""
    app = request_id.RequestId(app)

    if CONF.audit.enabled:
        try:
            app = audit_middleware.AuditMiddleware(
                app,
                audit_map_file=CONF.audit.audit_map_file,
                ignore_req_list=CONF.audit.ignore_req_list
            )
        except (EnvironmentError, OSError,
                audit_middleware.PycadfAuditApiConfigError) as e:
            raise exceptions.InputFileError(
                file_name=CONF.audit.audit_map_file,
                reason=e
            )

    if cfg.CONF.api_settings.auth_strategy == constants.KEYSTONE:
        app = keystone.SkippingAuthProtocol(app, {})

    app = http_proxy_to_wsgi.HTTPProxyToWSGI(app)

    # This should be the last middleware in the list (which results in
    # it being the first in the middleware chain). This is to ensure
    # that any errors thrown by other middleware, such as an auth
    # middleware - are annotated with CORS headers, and thus accessible
    # by the browser.
    app = cors.CORS(app, cfg.CONF)
    cors.set_defaults(
        allow_headers=['X-Auth-Token', 'X-Openstack-Request-Id'],
        allow_methods=['GET', 'PUT', 'POST', 'DELETE'],
        expose_headers=['X-Auth-Token', 'X-Openstack-Request-Id']
    )

    return app 
开发者ID:openstack,项目名称:octavia,代码行数:38,代码来源:app.py

示例10: parse_args

# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def parse_args(argv, default_config_files=None):
    rpc.set_defaults(control_exchange='magnum')
    CONF(argv[1:],
         project='magnum',
         version=version.version_info.release_string(),
         default_config_files=default_config_files)
    rpc.init(CONF) 
开发者ID:openstack,项目名称:magnum,代码行数:9,代码来源:config.py

示例11: test_config_defaults

# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def test_config_defaults(self):
        """Assert that using set_defaults overrides the appropriate values."""

        cors.set_defaults(**self.override_opts)

        for opt in cors.CORS_OPTS:
            if opt.dest in self.override_opts:
                self.assertEqual(self.override_opts[opt.dest], opt.default) 
开发者ID:openstack,项目名称:oslo.middleware,代码行数:10,代码来源:test_cors.py

示例12: test_invalid_default_option

# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def test_invalid_default_option(self):
        """Assert that using set_defaults only permits valid options."""

        self.assertRaises(AttributeError,
                          cors.set_defaults,
                          allowed_origin='test') 
开发者ID:openstack,项目名称:oslo.middleware,代码行数:8,代码来源:test_cors.py

示例13: set_middleware_defaults

# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_middleware_defaults():
    """Update default configuration options for oslo.middleware."""
    cors.set_defaults(
        allow_headers=['X-Auth-Token',
                       'X-Openstack-Request-Id',
                       'X-Project-Id',
                       'X-Identity-Status',
                       'X-User-Id',
                       'X-Storage-Token',
                       'X-Domain-Id',
                       'X-User-Domain-Id',
                       'X-Project-Domain-Id',
                       'X-Roles'],
        expose_headers=['X-Auth-Token',
                        'X-Openstack-Request-Id',
                        'X-Project-Id',
                        'X-Identity-Status',
                        'X-User-Id',
                        'X-Storage-Token',
                        'X-Domain-Id',
                        'X-User-Domain-Id',
                        'X-Project-Domain-Id',
                        'X-Roles'],
        allow_methods=['GET',
                       'PUT',
                       'POST',
                       'DELETE',
                       'PATCH']
    ) 
开发者ID:openstack,项目名称:barbican,代码行数:31,代码来源:config.py

示例14: parse_args

# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def parse_args(argv, name, default_config_files=None):
    log.register_options(CONF)

    if profiler:
        profiler.set_defaults(CONF)

    set_config_defaults()

    CONF(
        argv[1:],
        project='senlin',
        prog=name,
        version=version.version_info.version_string(),
        default_config_files=default_config_files,
    ) 
开发者ID:openstack,项目名称:senlin,代码行数:17,代码来源:config.py

示例15: set_config_defaults

# 需要导入模块: from oslo_middleware import cors [as 别名]
# 或者: from oslo_middleware.cors import set_defaults [as 别名]
def set_config_defaults():
    """Return a list of oslo.config options available in Inspector code."""
    log.set_defaults(default_log_levels=['sqlalchemy=WARNING',
                                         'iso8601=WARNING',
                                         'requests=WARNING',
                                         'urllib3.connectionpool=WARNING',
                                         'keystonemiddleware=WARNING',
                                         'keystoneauth=WARNING',
                                         'ironicclient=WARNING',
                                         'amqp=WARNING',
                                         'amqplib=WARNING',
                                         # This comes in two flavors
                                         'oslo.messaging=WARNING',
                                         'oslo_messaging=WARNING'])
    set_cors_middleware_defaults() 
开发者ID:openstack,项目名称:ironic-inspector,代码行数:17,代码来源:opts.py


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