diff --git a/.travis.yml b/.travis.yml index 7dd0167..0dfa9fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: python python: - - "2.5" - "2.6" - "2.7" + - "3.3" before_install: - export PIP_USE_MIRRORS=true - export PIP_INDEX_URL=https://simple.crate.io/ @@ -14,3 +14,4 @@ script: env: - DJANGO=1.3.3 - DJANGO=1.4.1 + - DJANGO=1.5rc1 diff --git a/configurations/base.py b/configurations/base.py index a1f262d..4e4fbf8 100644 --- a/configurations/base.py +++ b/configurations/base.py @@ -1,3 +1,4 @@ +import six from django.conf import global_settings from django.core.exceptions import ImproperlyConfigured @@ -15,7 +16,7 @@ install_failure = ("django-configurations settings importer wasn't " class SettingsBase(type): def __new__(cls, name, bases, attrs): - if bases != (object,): + if bases != (object,) and bases[0].__name__ != 'NewBase': # if this is actually a subclass in a settings module # we better check if the importer was correctly installed from . import importer @@ -33,7 +34,7 @@ class SettingsBase(type): return "" % (self.__module__, self.__name__) -class Settings(object): +class Settings(six.with_metaclass(SettingsBase)): """ The base configuration class to inherit from. @@ -57,4 +58,4 @@ class Settings(object): to the name of the class. """ - __metaclass__ = SettingsBase + pass diff --git a/configurations/importer.py b/configurations/importer.py index 6933eca..43a6e84 100644 --- a/configurations/importer.py +++ b/configurations/importer.py @@ -78,7 +78,7 @@ def install(): 'DJANGO_CONFIGURATION environment variable will ' 'be used.'),) - sys.meta_path.append(SettingsImporter()) + sys.meta_path.insert(0, SettingsImporter()) installed = True # now patch the active runserver command to show a nicer output @@ -145,7 +145,7 @@ class SettingsLoader(object): (self.name, mod.__package__)) try: obj = cls() - except Exception, err: + except Exception as err: raise ImproperlyConfigured("Couldn't load settings '%s.%s': %s" % (mod.__name__, self.name, err)) for name, value in uppercase_attributes(obj).items(): diff --git a/setup.py b/setup.py index 577b686..d41a1cb 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ from setuptools import setup def read(*parts): file_path = path.join(path.dirname(__file__), *parts) - return codecs.open(file_path).read() + return codecs.open(file_path, encoding='utf-8').read() def find_version(*parts):