Opened 13 years ago

Closed 13 years ago

#16894 closed Bug (duplicate)

UnicodeDecodeError handled incorrectly in WSGIHandler.__call__()

Reported by: Roy Smith 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

Description

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

           try:
                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/basehttp.py", line 283, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/lib/pymodules/python2.6/django/contrib/staticfiles/handlers.py", line 68, in __call__
    return self.application(environ, start_response)
  File "/usr/lib/pymodules/python2.6/django/core/handlers/wsgi.py", line 264, in __call__
    logger.warning('Bad Request (UnicodeDecodeError): %s' % request.path,
UnboundLocalError: local variable 'request' referenced before assignment

Change History (1)

comment:1 by Carl Meyer, 13 years ago

Resolution: duplicate
Status: newclosed

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