Changeset 5862
- Timestamp:
- 08/11/07 22:23:53 (1 year ago)
- Files:
-
- django/trunk/django/views/debug.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/views/debug.py
r5609 r5862 124 124 'lineno': '?', 125 125 }] 126 127 unicode_hint = '' 128 if issubclass(exc_type, UnicodeError): 129 start = getattr(exc_value, 'start', None) 130 end = getattr(exc_value, 'end', None) 131 if start is not None and end is not None: 132 unicode_str = exc_value.args[1] 133 unicode_hint = smart_unicode(unicode_str[max(start-5, 0):min(end+5, len(unicode_str))], 'ascii', errors='replace') 134 126 135 t = Template(TECHNICAL_500_TEMPLATE, name='Technical 500 template') 127 136 c = Context({ 128 137 'exception_type': exc_type.__name__, 129 138 'exception_value': smart_unicode(exc_value, errors='replace'), 139 'unicode_hint': unicode_hint, 130 140 'frames': frames, 131 141 'lastframe': frames[-1], … … 259 269 #template, #template-not-exist { background:#f6f6f6; } 260 270 #template-not-exist ul { margin: 0 0 0 20px; } 271 #unicode-hint { background:#eee; } 261 272 #traceback { background:#eee; } 262 273 #requestinfo { background:#f6f6f6; padding-left:120px; } … … 359 370 </table> 360 371 </div> 372 {% if unicode_hint %} 373 <div id="unicode-hint"> 374 <h2>Unicode error hint</h2> 375 <p>The string that could not be encoded/decoded was: <strong>{{ unicode_hint|escape }}</strong></p> 376 </div> 377 {% endif %} 361 378 {% if template_does_not_exist %} 362 379 <div id="template-not-exist">
