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


Python Registry.settings方法代码示例

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


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

示例1: setUp

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import settings [as 别名]
    def setUp(self):
        cache_opts = {
            'cache.type': 'memory',
            'cache.regions': 'public.data,public.filtered_data,public.shortlived'
        }
        CacheManager(**parse_cache_config_options(cache_opts))
        self.__request = DummyRequest()
        # Must set hook_zca to false to work with uniittest_with_sqlite
        reg = Registry()
        reg.settings = {}
        reg.settings = {'extract.available_grades': '3,4,5,6,7,8,9,11',
                        'hpz.file_upload_base_url': 'http://somehost:82/files',
                        'extract.raw_data_base_dir': '/opt/edware/raw_data'}
        self.__config = testing.setUp(registry=reg, request=self.__request, hook_zca=False)
        self.__tenant_name = get_unittest_tenant_name()

        defined_roles = [(Allow, RolesConstants.AUDIT_XML_EXTRACTS, ('view', 'logout'))]
        edauth.set_roles(defined_roles)
        set_tenant_map({get_unittest_tenant_name(): 'NC'})
        # Set up context security
        dummy_session = create_test_session([RolesConstants.AUDIT_XML_EXTRACTS])
        self.__config.testing_securitypolicy(dummy_session.get_user())
        # celery settings for UT
        settings = {'extract.celery.CELERY_ALWAYS_EAGER': True}
        setup_celery(settings)
        # for UT purposes
        smarter.extracts.format.json_column_mapping = {}
        set_tenant_map({'tomcat': 'NC'})
开发者ID:,项目名称:,代码行数:30,代码来源:

示例2: setUp

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import settings [as 别名]
 def setUp(self):
     self.__request = DummyRequest()
     self.__request.matchdict['registration_id'] = 'a1-b2-c3-d4-e5'
     self.__request.headers['File-Name'] = 'dummy.zip'
     reg = Registry()
     reg.settings = {'hpz.frs.upload_base_path': '/dev/null', 'hpz.frs.file_size_limit': '1024'}
     self.__config = testing.setUp(registry=reg, request=self.__request, hook_zca=False)
开发者ID:SmarterApp,项目名称:RDW_DataWarehouse,代码行数:9,代码来源:test_upload_service.py

示例3: _makeRequest

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import settings [as 别名]
 def _makeRequest(self, **kwargs):
     """:rtype: pyramid.request.Request"""
     from pyramid.registry import Registry
     registry = Registry()
     registry.settings = {'app.timezone': 'Asia/Bangkok'}
     testing.setUp(registry=registry)
     return testing.DummyRequest(**kwargs)
开发者ID:,项目名称:,代码行数:9,代码来源:

示例4: setUp

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import settings [as 别名]
 def setUp(self):
     reg = Registry()
     reg.settings = {'store_type':'rdflib',
                     'debug_sparql':True}
     self.config = testing.setUp(reg)
     self.config.add_settings({'mako.directories':'plingback.sparql:templates'})
     self.config.add_renderer(None, mako_renderer_factory)
     self.config.begin()
开发者ID:neontribe,项目名称:PlingBack,代码行数:10,代码来源:tests.py

示例5: test_dn_with_one_base_element

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import settings [as 别名]
 def test_dn_with_one_base_element(self):
     reg = Registry()
     reg.settings = {}
     reg.settings['ldap.base.dn'] = 'ou=dummy'
     self.__config = testing.setUp(registry=reg, request=DummyRequest(), hook_zca=False)
     attributes = {'dn': ['ou=dummyOrg,ou=dummy']}
     tenant = BasicIdentityParser.get_tenant_name(attributes)
     self.assertEqual(tenant[0], 'dummyorg')
开发者ID:SmarterApp,项目名称:RDW_DataWarehouse,代码行数:10,代码来源:test_basic_identity_parser.py

示例6: setUp

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import settings [as 别名]
 def setUp(self):
     reg = Registry()
     reg.settings = {}
     reg.settings['session.backend.type'] = 'beaker'
     reg.settings['cache.expire'] = 10
     reg.settings['cache.regions'] = 'session'
     reg.settings['cache.type'] = 'memory'
     reg.settings['batch.user.session.timeout'] = 15
     component.provideUtility(SessionBackend(reg.settings), ISessionBackend)
开发者ID:SmarterApp,项目名称:RDW_DataWarehouse,代码行数:11,代码来源:test_batch_user_session.py

示例7: _makeRegistry

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import settings [as 别名]
 def _makeRegistry(self, **kw):
     """:rtype: pyramid.registry.Registry"""
     from pyramid.registry import Registry
     registry = Registry()
     registry.settings = {
         'app.timezone': 'Asia/Bangkok',
         'app.secret': 'demo',
     }
     registry.settings.update(kw)
     return registry
开发者ID:,项目名称:,代码行数:12,代码来源:

示例8: setUp

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import settings [as 别名]
 def setUp(self):
     self.__request = DummyRequest()
     # Must set hook_zca to false to work with uniittest_with_sqlite
     reg = Registry()
     reg.settings = {}
     reg.settings['cache.expire'] = 10
     reg.settings['cache.regions'] = 'session'
     reg.settings['cache.type'] = 'memory'
     reg.settings['batch.user.session.timeout'] = 15
     component.provideUtility(SessionBackend(reg.settings), ISessionBackend)
     self.__config = testing.setUp(registry=reg, request=self.__request, hook_zca=False)
开发者ID:SmarterApp,项目名称:RDW_DataWarehouse,代码行数:13,代码来源:test_callback.py

示例9: setUp

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import settings [as 别名]
 def setUp(self):
     registry = Registry()
     registry.settings = settings
     self.config = testing.setUp(registry=registry)
     # setup db
     DBSession.configure(bind=engine)
     Base.metadata.bind = engine
     Base.metadata.drop_all()
     Base.metadata.create_all()
     # setup request
     self.request = testing.DummyRequest()
开发者ID:onaio,项目名称:dashboard-skeleton,代码行数:13,代码来源:test_base.py

示例10: test_heartbeat_fail

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import settings [as 别名]
 def test_heartbeat_fail(self):
     tested = False
     hpz_connector.HPZ_NAMESPACE = 'edware.db.tomcat.foo'
     with tempfile.TemporaryDirectory() as tmp:
         request = DummyRequest()
         reg = Registry()
         reg.settings = {'hpz.frs.upload_base_path': tmp}
         testing.setUp(registry=reg, request=request, hook_zca=False)
         res = heartbeat(request)
         tested = True
     self.assertTrue(tested)
     self.assertEqual(type(res), HTTPServerError)
开发者ID:SmarterApp,项目名称:RDW_DataWarehouse,代码行数:14,代码来源:test_heartbeat.py

示例11: setUp

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import settings [as 别名]
    def setUp(self):
        parser = ConfigParser()
        parser.read('../production.ini')
        pval = partial(parser.get, 'app:main')

        testRegistry = Registry()
        testRegistry.settings = {'mandrill_key': pval('mandrill_key')}

        self.config = testing.setUp(registry=testRegistry)

        setup_auth(self.config)
        setup_tweens(self.config)
        setup_routes(self.config)
        self.config.testing_securitypolicy(userid=self.contributor.username)
开发者ID:hadrien,项目名称:PackAssembler,代码行数:16,代码来源:tests.py

示例12: setUp

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import settings [as 别名]
    def setUp(self):
        parser = ConfigParser()
        parser.read('../production.ini')
        pval = partial(parser.get, 'app:main')

        testRegistry = Registry()
        testRegistry.settings = {'mandrill_key': pval('mandrill_key')}

        self.config = testing.setUp(registry=testRegistry)
        self.config.include('packassembler.routes')
        self.config.include('packassembler.tweens')
        self.config.include('packassembler.security')
        self.config.include('packassembler.sessions')

        self.config.testing_securitypolicy(userid=self.contributor.username)
开发者ID:PackAssembler,项目名称:PackAssembler,代码行数:17,代码来源:tests.py

示例13: setUp

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import settings [as 别名]
 def setUp(self):
     # delete all user_session before test
     mappings = {('Allow', 'TEACHER', ('view', 'logout', 'default')),
                 ('Allow', 'SYSTEM_ADMINISTRATOR', ('view', 'logout')),
                 ('Allow', 'DATA_LOADER', ('view', 'logout')),
                 ('Allow', 'NONE', ('logout'))}
     Roles.set_roles(mappings)
     set_tenant_map({get_unittest_tenant_name(): 'NC'})
     self.__request = DummyRequest()
     reg = Registry()
     reg.settings = {}
     reg.settings['session.backend.type'] = 'beaker'
     reg.settings['cache.expire'] = 10
     reg.settings['cache.regions'] = 'session'
     reg.settings['cache.type'] = 'memory'
     reg.settings['ldap.base.dn'] = 'ou=environment,dc=edwdc,dc=net'
     reg.settings['batch.user.session.timeout'] = 15
     component.provideUtility(SessionBackend(reg.settings), ISessionBackend)
     # Must set hook_zca to false to work with uniittest_with_sqlite
     self.__config = testing.setUp(registry=reg, request=self.__request, hook_zca=False)
开发者ID:SmarterApp,项目名称:RDW_DataWarehouse,代码行数:22,代码来源:test_session_manager.py

示例14: test_registration_valid_url

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import settings [as 别名]
    def test_registration_valid_url(self, persist_patch):
        reg = Registry()
        reg.settings = {'hpz.frs.download_base_url': 'http://blah/download'}
        self.__config = testing.setUp(registry=reg, request=self.__request, hook_zca=False)

        persist_patch.return_value = None

        self.__request.method = 'PUT'
        self.__request.json_body = {'uid': '1234', 'email': '[email protected]'}

        response = put_file_registration_service(None, self.__request)

        self.assertEqual(response.status_code, 200)

        response_json = json.loads(str(response.body, encoding='UTF-8'))

        self.assertTrue('url' in response_json)
        self.assertTrue('registration_id' in response_json)
        registration_id = response_json['registration_id']
        self.assertEqual('http://blah/files/' + registration_id, response_json['url'])
开发者ID:SmarterApp,项目名称:RDW_DataWarehouse,代码行数:22,代码来源:test_registration.py

示例15: _make_registry

# 需要导入模块: from pyramid.registry import Registry [as 别名]
# 或者: from pyramid.registry.Registry import settings [as 别名]
 def _make_registry(self, **kw):
     r = Registry('testing')
     r.settings = kw
     return r
开发者ID:nandoflorestan,项目名称:pluserable,代码行数:6,代码来源:__init__.py


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