Ticket #8033: better_error_handling_for_ugettext_r8138.3.diff
File better_error_handling_for_ugettext_r8138.3.diff, 2.8 KB (added by , 16 years ago) |
---|
-
django/core/handlers/base.py
62 62 "Returns an HttpResponse object for the given HttpRequest" 63 63 from django.core import exceptions, urlresolvers 64 64 from django.conf import settings 65 from django.db.models.loading import get_apps 65 66 67 # Force app loading 68 get_apps() 69 66 70 # Apply request middleware 67 71 for middleware_method in self._request_middleware: 68 72 response = middleware_method(request) -
django/core/exceptions.py
28 28 "Django is somehow improperly configured" 29 29 pass 30 30 31 class ImproperlyImplemented(Exception): 32 "Django is somehow improperly implemented" 33 pass 34 31 35 class FieldError(Exception): 32 36 """Some kind of problem with a model field.""" 33 37 pass -
django/views/debug.py
60 60 61 61 def get_traceback_html(self): 62 62 "Return HTML code for traceback." 63 from django.utils import translation 64 translation.deactivate_all() # avoid possible translation errors in 500 error handling 63 65 64 66 if issubclass(self.exc_type, TemplateDoesNotExist): 65 67 from django.template.loader import template_source_loaders -
django/utils/translation/trans_real.py
7 7 import gettext as gettext_module 8 8 from cStringIO import StringIO 9 9 10 from django.core.exceptions import ImproperlyImplemented 11 from django.db.models.loading import app_cache_ready, get_apps 10 12 from django.utils.safestring import mark_safe, SafeData 11 13 from django.utils.thread_support import currentThread 12 14 … … 270 272 """ 271 273 global _default, _active 272 274 t = _active.get(currentThread(), None) 275 if not app_cache_ready() and \ 276 not isinstance(t, gettext_module.NullTranslations): 277 raise ImproperlyImplemented( 278 "django.utils.translation.%(func_name)s function called at " 279 "import time to perform a translation of '%(message)s'. " 280 "%(func_name)s function must be called after " 281 "applications loading." % {'func_name': translation_function, 282 'message': message}) 273 283 if t is not None: 274 284 result = getattr(t, translation_function)(message) 275 285 else: