Beispiel #1
0
    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
Beispiel #2
0
 def __enter__(self):
     landlord.push(self)
Beispiel #3
0
 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)