Ticket #5046: views_debug_unicodeerror_hint.diff
File views_debug_unicodeerror_hint.diff, 1.1 KB (added by , 17 years ago) |
---|
-
views/debug.py
123 128 'function': '?', 124 129 'lineno': '?', 125 130 }] 131 132 hint="" 133 if issubclass(exc_type, UnicodeError): 134 start=getattr(exc_value, 'start', None) 135 end=getattr(exc_value, 'end', None) 136 if start!=None and end!=None: 137 ustr=exc_value.args[1] 138 hint=smart_unicode(ustr[max(start-5, 0):min(end+5, len(ustr))], "ascii", "replace") 126 139 t = Template(TECHNICAL_500_TEMPLATE, name='Technical 500 template') 127 140 c = Context({ 128 141 'exception_type': exc_type.__name__, 129 142 'exception_value': smart_unicode(exc_value, errors='replace'), 143 'hint': hint, 130 144 'frames': frames, 131 145 'lastframe': frames[-1], 132 146 'request': request, … … 356 370 <th>Python Version:</th> 357 371 <td>{{ sys_version_info }}</td> 358 372 </tr> 373 <tr> 374 <th>Hint:</th> 375 <td>{{ hint }}</td> 376 </tr> 359 377 </table> 360 378 </div> 361 379 {% if template_does_not_exist %}