#27287: IndexError on broken pipe
------------------------------------+--------------------
Reporter: Sjoerd Job Postmus | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
------------------------------------+--------------------
In `WSGIServer.handle_error`, on a broken pipe, it calls `logger.info`
with 2 arguments: a format and an address.
This uses the `ServerFormatter`, which expects either 0 or >= 2 args.
{{{
Traceback (most recent call last):
File "/usr/lib/python2.7/logging/__init__.py", line 851, in emit
msg = self.format(record)
File "/usr/lib/python2.7/logging/__init__.py", line 724, in format
return fmt.format(record)
File "/.../django/utils/log.py", line 173, in format
if args[1][0] == '2':
IndexError: tuple index out of range
Logged from file basehttp.py, line 85
}}}
I think a good fix might be to make it check against `len(args) < 2`
instead of `len(args) == 0`.
While the code is being touched, it might also be a good idea to write
`status_code = args[1]`, and use that in the `if`-chain.
--
Ticket URL: <https://code.djangoproject.com/ticket/27287>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.f898fb1d5dce00f2487456039eb9e1cb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.