Merge pull request #18 from mvantellingen/python3

Python3
This commit is contained in:
Jannis Leidel 2013-03-27 03:58:03 -07:00
commit f7696e5810
5 changed files with 12 additions and 7 deletions

View file

@ -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

View file

@ -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 "<Settings '%s.%s'>" % (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

View file

@ -62,7 +62,7 @@ def install():
# add the configuration option to all management commands
base.BaseCommand.option_list += configuration_options
sys.meta_path.append(SettingsImporter())
sys.meta_path.insert(0, SettingsImporter())
installed = True
# now patch the active runserver command to show a nicer output
@ -133,7 +133,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))
try:

View file

@ -1,10 +1,13 @@
import os
import uuid
from configurations import Settings
class Test(Settings):
SITE_ID = 1
SECRET_KEY = str(uuid.uuid4())
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',

View file

@ -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):