def process_request(self, request): namespace = self.identify(request=request) if not namespace and settings.HTTP_404_ON_UNKNOWN_NAMESPACE: raise Http404() landlord.push(namspace) request.namespace = namespace
def __enter__(self): landlord.push(self)
def test_basic(self): random_str = randomStr(24) landlord.push(random_str) self.assertEqual(landlord.get_current_namespace(), random_str) landlord.pop() self.assertEqual(landlord.get_current_namespace(), None)