﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
16229	django.core.validators not usable without a DJANGO_SETTINGS_MODULE	Jonas H.	nobody	"https://code.djangoproject.com/browser/django/trunk/django/core/validators.py#L16 reads (after catching a Django settings `ImportError`):

> It's OK if Django settings aren't configured.

However, using the `validate_email` validator crashes without a `DJANGO_SETTINGS_MODULE`:


{{{
>>> from django.core.validators import validate_email
>>> validate_email('foo')
Traceback (most recent call last):
  File ""<stdin>"", line 1, in <module>
  File ""django/core/validators.py"", line 120, in __call__
    super(EmailValidator, self).__call__(value)
  File ""django/core/validators.py"", line 40, in __call__
    raise ValidationError(self.message, code=self.code)
  File ""django/core/exceptions.py"", line 60, in __init__
    message = force_unicode(message)
  File ""django/utils/encoding.py"", line 71, in force_unicode
    s = unicode(s)
  File ""django/utils/functional.py"", line 108, in __unicode_cast
    return self.__func(*self.__args, **self.__kw)
  File ""django/utils/translation/__init__.py"", line 87, in ugettext
    return _trans.ugettext(message)
  File ""django/utils/translation/__init__.py"", line 49, in __getattr__
    if settings.USE_I18N:
  File ""django/utils/functional.py"", line 180, in __getattr__
    self._setup()
  File ""django/conf/__init__.py"", line 40, in _setup
    raise ImportError(""Settings cannot be imported, because environment variable %s is undefined."" % ENVIRONMENT_VARIABLE)
ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.
}}}
"	Cleanup/optimization	closed	Core (Other)	dev	Normal	invalid			Unreviewed	0	0	0	0	0	0
