request.POST does not evaluate to True if there are no form variables
|Reported by:||anonymous||Owned by:||Adrian Holovaty|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
A common idiom encouraged by the docs is using
if request.POST: to see if a function was called using the POST method. But since request.POST is a dictionary-like thing, if the form that was POSTed contains no variables, request.POST evaluates to False. Since this idiom is much more common than the one testing for whether the form had contents, I suggest that request.POST should evaluate to True if the method is POST, regardless of whether there was form content.