Beispiel #1
0
    def process_response(self, request, response):
        if hasattr(request, settings.LANDLORD_DEFAULT_NAMESPACE_KEY):
            namespace = getattr(request, settings.LANDLORD_DEFAULT_NAMESPACE_KEY)
            if namespace:
                landlord.pop()
        return response

    # def process_exception(self, request, exception):
    #     if isinstance(exception, TenantNotFound):
    #         if self.tenant_not_found_handler:
    #             self.tenant_not_found_handler(request, exception)
Beispiel #2
0
 def __exit__(self, type, value, tb):
     landlord.pop()
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)