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 12820 for param in request.REQUEST fails with (a misleading) KeyError exception Tamas Szabo nobody "If you do a ""for param in"" on request.POST or request.GET it works as expected, but if you do it on request.REQUEST it fails. The following simple code {{{ for param in request.REQUEST: print param }}} will throw a KeyError exception! A few WTFs later I realized that the problem is in django.util.datastructures.MergeDict, that doesn't implement __iter__, but it does implement __getitem__ so the for calls into __getitem__ and passes in 0 (index of first element in a sequence). 0 won't be a valid key in request.GET or request.POST so a KeyError is thrown by the MergeDict.__getitem__ implementation. I've attached a patch that adds the missing __iter__ method. " closed Core (Other) dev fixed Accepted 1 0 0 0 0 0