﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27191	Generation of error reports fails if request.GET, POST, FILES or COOKIES contains key 'items'	Anatoly Burov	nobody	"When `DEBUG` is True, if the `request.GET` or another QueryDict contains key named `'items'` and a view raises an exception, the generation of error report fails. Due to a difference in `django.views.debug.TECHNICAL_500_TEMPLATE` and `TECHNICAL_500_TEXT_TEMPLATE`, the actual behaviour varies.

==== Normal requests ====

For normal requests the output ''is'' produced, but the query variables are dumped in a wrong way. For example, for request 'GET /test/?items=Oops' the dump will contain a table:

** GET **
|| Variable || Value ||
|| O || `''` ||
|| o || `''` ||
|| p || `''` ||
|| s || `''` ||

This is because `TECHNICAL_500_TEMPLATE` iterates QueryDict this way:

{{{
{% for var in filtered_POST.items %} ... {{ var.0 }} ... {{ var.1 }} ...
}}}


==== Ajax requests ====

For ajax requests the plain text error report generation itself raises an exception:

{{{
ValueError: Need 2 values to unpack in for loop; got 1.
}}}

The console gets flooded with the tracedumps and the upstream eventually receives a `502 Bad Gateway`.

This is because `TECHNICAL_500_TEXT_TEMPLATE` iterates QueryDict this way:

{{{
{% for k, v in request.GET.items %} ... {{ k }} ... {{ v }} ...
}}}"	Bug	closed	Error reporting	1.10	Normal	fixed			Accepted	1	0	0	0	0	0
