Opened 4 years ago

Closed 4 years ago

#16894 closed Bug (duplicate)

UnicodeDecodeError handled incorrectly in WSGIHandler.__call__()

Reported by: RoySmith Owned by: nobody
Component: Core (Other) Version: 1.3
Severity: Release blocker Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


In django/core/handlers/, around line 262, is the following code:

                request = self.request_class(environ)
            except UnicodeDecodeError:
                logger.warning('Bad Request (UnicodeDecodeError): %s' % request.path,

when the exception is caught, request is undefined, leading to:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/django/core/servers/", line 283, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/lib/pymodules/python2.6/django/contrib/staticfiles/", line 68, in __call__
    return self.application(environ, start_response)
  File "/usr/lib/pymodules/python2.6/django/core/handlers/", line 264, in __call__
    logger.warning('Bad Request (UnicodeDecodeError): %s' % request.path,
UnboundLocalError: local variable 'request' referenced before assignment

Change History (1)

comment:1 Changed 4 years ago by carljm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

This is a duplicate of #15672 and is already fixed in trunk (r15918). Thanks for the report!

Note: See TracTickets for help on using tickets.
Back to Top