Ticket #5884: django_template_debug_handle_unicode_error.diff
File django_template_debug_handle_unicode_error.diff, 1.1 KB (added by , 17 years ago) |
---|
-
django/template/__init__.py
128 128 self.msg = msg 129 129 self.params = params 130 130 131 def __ str__(self):132 return self.msg % self.params131 def __unicode__(self): 132 return self.msg % tuple([force_unicode(p, errors='replace') for p in self.params]) 133 133 134 134 class InvalidTemplateLibrary(Exception): 135 135 pass -
django/template/debug.py
75 75 raise 76 76 except Exception, e: 77 77 from sys import exc_info 78 wrapped = TemplateSyntaxError( 'Caught an exception while rendering: %s' % e)78 wrapped = TemplateSyntaxError(u'Caught an exception while rendering: %s' % force_unicode(e, errors='replace')) 79 79 wrapped.source = node.source 80 80 wrapped.exc_info = exc_info() 81 81 raise wrapped