#16229: django.core.validators not usable without a DJANGO_SETTINGS_MODULE --------------------+------------------------------ Reporter: jonash | Owner: nobody Type: Bug | Status: new Milestone: | Component: Core (Other) Version: 1.3 | Severity: Normal Keywords: | Triage Stage: Unreviewed Has patch: 0 | Easy pickings: 0 UI/UX: 0 | --------------------+------------------------------ 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. }}} -- Ticket URL: <https://code.djangoproject.com/ticket/16229> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.