Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #12649 - more helpful Unicode exceptions for CSRF migration hel…

…per script

Thanks akaihola



git-svn-id: http://code.djangoproject.com/svn/django/trunk@12266 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 1af45dc7bc711cd62867712c998e95c117999d43 1 parent 5cd4c3e
@spookylukey spookylukey authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 extras/csrf_migration_helper.py
View
7 extras/csrf_migration_helper.py
@@ -176,7 +176,12 @@ def content(self):
return self._content
except AttributeError:
fd = open(self.absolute_filename)
- content = fd.read().decode(TEMPLATE_ENCODING)
+ try:
+ content = fd.read().decode(TEMPLATE_ENCODING)
+ except UnicodeDecodeError, e:
+ message = '%s in %s' % (
+ e[4], self.absolute_filename.encode('UTF-8', 'ignore'))
+ raise UnicodeDecodeError(*(e.args[:4] + (message,)))
fd.close()
self._content = content
return content
Please sign in to comment.
Something went wrong with that request. Please try again.