Merge branch 'master' of github.com:jezdez/django-configurations

This commit is contained in:
Jannis Leidel 2015-01-06 21:38:20 +01:00
commit ebc0c51dd8
2 changed files with 8 additions and 2 deletions

View file

@ -44,7 +44,7 @@ class Value(object):
def __new__(cls, *args, **kwargs):
"""
checks if the creation can end up directly in the final value.
That is the case whenever environ = False or environ_name is given
That is the case whenever environ = False or environ_name is given.
"""
instance = object.__new__(cls)
instance.__init__(*args, **kwargs)
@ -59,7 +59,7 @@ class Value(object):
environ_prefix='DJANGO', *args, **kwargs):
if 'late_binding' in kwargs:
self.late_binding = kwargs.get('late_binding')
if isinstance(default, Value) and default.default:
if isinstance(default, Value) and default.default is not None:
self.default = copy.copy(default.default)
else:
self.default = default

View file

@ -108,6 +108,12 @@ class ValueTests(TestCase):
with env(DJANGO_TEST='nonboolean'):
self.assertRaises(ValueError, value.setup, 'TEST')
def test_boolean_values_assign_false_to_another_booleanvalue(self):
value1 = BooleanValue(False)
value2 = BooleanValue(value1)
self.assertFalse(value1.setup('TEST1'))
self.assertFalse(value2.setup('TEST2'))
def test_integer_values(self):
value = IntegerValue(1)
with env(DJANGO_TEST='2'):