def guillotina_main(loop): HARD_CACHE.clear() from guillotina import test_package # noqa aioapp = make_app(settings=PG_SETTINGS, loop=loop) aioapp.config.execute_actions() load_cached_schema() yield aioapp
def guillotina_main(loop): HARD_CACHE.clear() aioapp = make_app(settings=get_pg_settings(), loop=loop) aioapp.config.execute_actions() load_cached_schema() yield aioapp loop.run_until_complete(close_async_tasks(aioapp))
def guillotina_main(loop): HARD_CACHE.clear() from guillotina import test_package # noqa aioapp = make_app(settings=get_pg_settings(), loop=loop) aioapp.config.execute_actions() load_cached_schema() yield aioapp close_async_tasks()
def dummy_request(dummy_guillotina, monkeypatch): HARD_CACHE.clear() from guillotina.interfaces import IApplication from guillotina.component import get_utility root = get_utility(IApplication, name='root') db = root['db'] request = get_mocked_request(db) return request
async def get_object_by_oid(oid, txn): """ Need to do a reverse lookup of the object to all the parents """ result = HARD_CACHE.get(oid, None) if result is None: result = await txn._get(oid) return await load_res(result, txn)
async def get_object(self, oid): if oid in self.cache: return self.cache[oid] try: result = self.txn._manager._hard_cache.get(oid, None) except AttributeError: from guillotina.db.transaction import HARD_CACHE # noqa result = HARD_CACHE.get(oid, None) if result is None: result = await self.txn._cache.get(oid=oid) if result is None: result = await self.tm._storage.load(self.txn, oid) obj = reader(result) obj._p_jar = self.txn if result['parent_id']: obj.__parent__ = await self.get_object(result['parent_id']) return obj
async def guillotina(test_server, postgres, guillotina_main, loop): HARD_CACHE.clear() server = await test_server(guillotina_main) requester = GuillotinaDBRequester(server=server, loop=loop) return requester
async def dummy_txn_root(dummy_request): HARD_CACHE.clear() return RootAsyncContextManager(dummy_request)