Ticket #4249: views_debug_py.diff
File views_debug_py.diff, 757 bytes (added by , 18 years ago) |
---|
-
django/branches/unicode/django/views/debug.py
old new 188 188 if source is None: 189 189 return None, [], None, [] 190 190 191 encoding=None 192 for line in source[0:min(len(source), 2)]: 193 # Convert lines to unicode. 194 # See: http://www.python.org/dev/peps/pep-0263/ 195 match = re.search(r'coding[:=]\s*([-\w.]+)', line) 196 if match: 197 encoding = match.group(1) 198 break 199 if encoding: 200 source = [unicode(sline, encoding) for sline in source] 201 191 202 lower_bound = max(0, lineno - context_lines) 192 203 upper_bound = lineno + context_lines 193 204