mirror of
https://github.com/jazzband/django-configurations.git
synced 2026-03-16 22:20:27 +00:00
Merge branch 'master' of github.com:jezdez/django-configurations
This commit is contained in:
commit
5d1a8d7887
3 changed files with 11 additions and 2 deletions
|
|
@ -266,7 +266,8 @@ class ValidationMixin(object):
|
|||
else:
|
||||
raise ValueError('Cannot use validator of '
|
||||
'{0} ({1!r})'.format(self, self.validator))
|
||||
self.to_python(self.default)
|
||||
if self.default:
|
||||
self.to_python(self.default)
|
||||
|
||||
def to_python(self, value):
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ a ``Configuration`` class::
|
|||
|
||||
from configurations import Configuration
|
||||
|
||||
class Prod(Configuration, FullPageCaching):
|
||||
class Prod(FullPageCaching, Configuration):
|
||||
DEBUG = False
|
||||
# ...
|
||||
|
||||
|
|
|
|||
|
|
@ -216,6 +216,14 @@ class ValueTests(TestCase):
|
|||
with env(DJANGO_TEST='httb://spam.eggs'):
|
||||
self.assertRaises(ValueError, value.setup, 'TEST')
|
||||
|
||||
def test_url_values_with_no_default(self):
|
||||
value = URLValue() # no default
|
||||
with env(DJANGO_TEST='http://spam.eggs'):
|
||||
self.assertEqual(value.setup('TEST'), 'http://spam.eggs')
|
||||
|
||||
def test_url_values_with_wrong_default(self):
|
||||
self.assertRaises(ValueError, URLValue, 'httb://spam.eggs')
|
||||
|
||||
def test_ip_values(self):
|
||||
value = IPValue('0.0.0.0')
|
||||
with env(DJANGO_TEST='127.0.0.1'):
|
||||
|
|
|
|||
Loading…
Reference in a new issue