def wrapper(*args, **kwargs): site = getSite() pushGlobalRegistry(site) try: register_static_uid_uitility(prefix=prefix or func.__name__) return func(*args, **kwargs) finally: popGlobalRegistry(site)
def tearDown(self): # disable create_inital_version handler for og.documents # otherwise we have some savepoints problems with the sqlite db handlers.MIGRATION = False sm = self.layer['portal'].getSiteManager() for component in self._utilities: sm.unregisterUtility(component) popGlobalRegistry(self.layer['portal']) super(TestViewsIntegration, self).tearDown()
def test_preflight_request_without_cors_policy_doesnt_render_service(self): # "Unregister" the current CORS policy class NoCORSPolicy(object): def __new__(cls, context, request): return None pushGlobalRegistry(self.portal) provideAdapter(NoCORSPolicy, (Interface, IDefaultBrowserLayer), ICORSPolicy) headers = {"HTTP_ACCESS_CONTROL_REQUEST_METHOD": "GET", "HTTP_ACCEPT": "*/*"} service = self.traverse(method="OPTIONS", headers=headers) self.assertTrue(service() is None, "Should return None") popGlobalRegistry(self.portal)
def tearDown(self): popGlobalRegistry(getSite())
def tearDown(self): self.time_freezer.stop() popGlobalRegistry(getSite())
def tearDown(self): super(Fixture, self).tearDown() with ploneSite() as portal: popGlobalRegistry(portal)
def __exit__(self, exc_type, exc_value, traceback): popGlobalRegistry(getSite())
def tearDown(self): portal = self.layer['portal'] popGlobalRegistry(portal)
def tearDown(self): popGlobalRegistry(self.portal)