Skip to content

Commit 457821f

Browse files
committed
Updated a middleware function to use the correct Py3 idiom to access exception arguments.
- Legacy-Id: 18504
1 parent 51806b1 commit 457821f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

ietf/middleware.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ def __call__(self, request):
4141
return self.get_response(request)
4242
def process_exception(self, request, exception):
4343
if isinstance(exception, OperationalError):
44-
extype, value, tb = exc_parts()
45-
if value[0] == 1366:
46-
log("Database 4-byte utf8 exception: %s: %s" % (extype, value))
44+
extype, e, tb = exc_parts()
45+
if e.args[0] == 1366:
46+
log("Database 4-byte utf8 exception: %s: %s" % (extype, e))
4747
return render(request, 'utf8_4byte_failed.html',
48-
{'exception': extype, 'args': value, 'traceback': "".join(tb)} )
48+
{'exception': extype, 'args': e.args, 'traceback': "".join(tb)} )
4949
return None
5050

5151
def redirect_trailing_period_middleware(get_response):

0 commit comments

Comments
 (0)