def process_request(self, request): mapper = utils.get_mapper() threadlocal = connection.get_threadlocal() threadlocal.set_tenant_name(mapper.get_tenant_name(request)) threadlocal.set_dbname(mapper.get_dbname(request)) threadlocal.set_cache_prefix(mapper.get_cache_prefix(request)) if 'django.contrib.sites' in settings.INSTALLED_APPS: # Clear the sites framework cache. from django.contrib.sites.models import Site Site.objects.clear_cache()
def process_request(self, request): mapper = utils.get_mapper() threadlocal = connection.get_threadlocal() tenant_name = mapper.get_tenant_name(request) threadlocal.set_tenant_name(tenant_name) db_name = mapper.get_db_name(request, tenant_name) # Fixes ValueError when trying to inject SQL, setting empty string as default try: threadlocal.set_db_name(db_name) except ValueError as ve: threadlocal.set_db_name('') threadlocal.set_cache_prefix(mapper.get_cache_prefix(request, tenant_name, db_name)) if 'django.contrib.sites' in settings.INSTALLED_APPS: # Clear the sites framework cache. from django.contrib.sites.models import Site Site.objects.clear_cache()
def process_request(self, request): mapper = utils.get_mapper() #mapper.get_tenant_name(request) threadlocal = utils.get_threadlocal() threadlocal.set_tenant_name( mapper.get_tenant_name(request, threadlocal))