예제 #1
0
 def test_it_with_no_registry(self):
     from pyramid.config import global_registries
     # keep registry local so that global_registries is cleared after
     registry = DummyRegistry(DummyFactory)
     global_registries.add(registry)
     request = self._callFUT('/hello')
     self.assertEqual(request.environ['path'], '/hello')
     self.assertEqual(request.registry, registry)
     global_registries.empty()
예제 #2
0
 def test_it_with_no_registry(self):
     from pyramid.config import global_registries
     registry = self._makeRegistry()
     global_registries.add(registry)
     try:
         request = self._callFUT('/hello')
         self.assertEqual(request.environ['path'], '/hello')
         self.assertEqual(request.registry, registry)
     finally:
         global_registries.empty()
예제 #3
0
 def test_it_with_no_registry(self):
     from pyramid.config import global_registries
     registry = self._makeRegistry()
     global_registries.add(registry)
     try:
         request = self._callFUT('/hello')
         self.assertEqual(request.environ['path'], '/hello')
         self.assertEqual(request.registry, registry)
     finally:
         global_registries.empty()
예제 #4
0
 def test_it_with_no_registry(self):
     from pyramid.config import global_registries
     # keep registry local so that global_registries is cleared after
     registry = DummyRegistry(DummyFactory)
     global_registries.add(registry)
     try:
         request = self._callFUT('/hello')
         self.assertEqual(request.environ['path'], '/hello')
         self.assertEqual(request.registry, registry)
     finally:
         global_registries.empty()
예제 #5
0
    def setUp(self):
        self.config = testing.setUp()
        self.config.include('arche.testing')
        self.config.include('arche.testing.catalog')
        self.config.include('arche.testing.workflow')
        self.config.registry.settings['arche_celery.ini'] = CONFIG_INI_TESTS
        self.config.include('arche_celery')
        self.root = barebone_fixture(self.config)
        request = testing.DummyRequest()
        apply_request_extensions(request)
        self.config.begin(request)
        global_registries.add(self.config.registry)

        def _root_fact(*args):
            return self.root

        self.config.set_root_factory(_root_fact)
예제 #6
0
def make_asyncio_app(config):
    self = config
    self.set_request_factory(RequestFactory())
    self.commit()
    app = Router(self)

    # Allow tools like "pshell development.ini" to find the 'last'
    # registry configured.
    global_registries.add(self.registry)

    # Push the registry onto the stack in case any code that depends on
    # the registry threadlocal APIs used in listeners subscribed to the
    # IApplicationCreated event.
    self.manager.push({'registry':self.registry, 'request':None})
    try:
        self.registry.notify(ApplicationCreated(app))
    finally:
        self.manager.pop()

    return app
예제 #7
0
def make_asyncio_app(config):
    self = config
    self.set_request_factory(RequestFactory())
    self.commit()
    app = Router(self)

    # Allow tools like "pshell development.ini" to find the 'last'
    # registry configured.
    global_registries.add(self.registry)

    # Push the registry onto the stack in case any code that depends on
    # the registry threadlocal APIs used in listeners subscribed to the
    # IApplicationCreated event.
    self.manager.push({'registry': self.registry, 'request': None})
    try:
        self.registry.notify(ApplicationCreated(app))
    finally:
        self.manager.pop()

    return app
예제 #8
0
    def setUp(self):
        self.config = testing.setUp()
        self.config.include('arche.testing')
        self.config.include('arche.testing.catalog')
        self.config.include('arche.testing.workflow')
        self.config.registry.settings['arche_celery.ini'] = CONFIG_INI_TESTS
        self.config.include('arche_celery')
        self.root = barebone_fixture(self.config)
        request = testing.DummyRequest()
        request.root = self.root
        apply_request_extensions(request)
        self.request = request
        self.config.begin(request)
        #Need to make registry accessible for worker.
        #This may change in pyramid
        global_registries.add(self.config.registry)

        def _root_fact(*args):
            return self.root

        self.config.set_root_factory(_root_fact)
예제 #9
0
파일: __init__.py 프로젝트: webmaven/ptah
 def make_wsgi_app(self): # pragma: no cover
     self.commit()
     global_registries.add(self.registry)
     return Router(self.registry)
예제 #10
0
 def make_wsgi_app(self):  # pragma: no cover
     self.commit()
     global_registries.add(self.registry)
     return Router(self.registry)