From b0c1a5c0cb7b2470033eb44e88c62763db507946 Mon Sep 17 00:00:00 2001 From: JensDiemer Date: Thu, 12 Feb 2015 11:08:47 +0100 Subject: [PATCH] Work-a-round for import loops --- README.creole | 2 ++ django_tools/__init__.py | 2 +- django_tools/dynamic_site/middleware.py | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.creole b/README.creole index 2f9ca69..c0c8ab1 100644 --- a/README.creole +++ b/README.creole @@ -197,6 +197,8 @@ to: == history +* v0.26.1 - 12.02.2015 +** Work-a-round for import loops * v0.26.0 - 11.02.2015 ** Updates for Django 1.6 and Python 3 * v0.25.1 - 18.11.2013 diff --git a/django_tools/__init__.py b/django_tools/__init__.py index 0c69f15..206cf37 100644 --- a/django_tools/__init__.py +++ b/django_tools/__init__.py @@ -1,7 +1,7 @@ # coding: utf-8 -__version__ = (0, 26, 0) +__version__ = (0, 26, 1) VERSION_STRING = '.'.join(str(part) for part in __version__) diff --git a/django_tools/dynamic_site/middleware.py b/django_tools/dynamic_site/middleware.py index a38150f..4824e1e 100644 --- a/django_tools/dynamic_site/middleware.py +++ b/django_tools/dynamic_site/middleware.py @@ -8,7 +8,7 @@ More info: read .../django_tools/dynamic_site/README.creole - :copyleft: 2011-2013 by the django-tools team, see AUTHORS for more details. + :copyleft: 2011-2015 by the django-tools team, see AUTHORS for more details. :license: GNU GPL v3 or above, see LICENSE for more details. """ @@ -31,7 +31,7 @@ from django.utils import log from django_tools.local_sync_cache.local_sync_cache import LocalSyncCache -from django_tools.dynamic_site.models import SiteAlias + USE_DYNAMIC_SITE_MIDDLEWARE = getattr(settings, "USE_DYNAMIC_SITE_MIDDLEWARE", False) @@ -160,6 +160,7 @@ def _get_site_from_host(self, host): site = Site.objects.get(domain__iexact=host) except Site.DoesNotExist: # Look if there is a alias + from django_tools.dynamic_site.models import SiteAlias # against import loops ;( try: site = SiteAlias.objects.get_from_host(host) except SiteAlias.DoesNotExist: