Ticket #8033: better_error_handling_for_ugettext_r8138.2.diff
File better_error_handling_for_ugettext_r8138.2.diff, 2.2 KB (added by , 16 years ago) |
---|
-
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/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/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 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 not isinstance(t, gettext_module.NullTranslations): 276 raise ImproperlyImplemented( 277 "django.utils.translation.%(func_name)s function called at " 278 "import time to perform a translation of '%(message)s'. " 279 "%(func_name)s function must be called after " 280 "applications loading." % {'func_name': translation_function, 281 'message': message}) 273 282 if t is not None: 274 283 result = getattr(t, translation_function)(message) 275 284 else: