Code

Opened 8 years ago

Closed 8 years ago

#888 closed defect (wontfix)

request.POST does not evaluate to True if there are no form variables

Reported by: anonymous Owned by: adrian
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

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.

Attachments (0)

Change History (1)

comment:1 Changed 8 years ago by adrian

  • Resolution set to wontfix
  • Status changed from new to closed

if request.POST is meant to be an idiom for checking whether any post data wasn't sent -- not whether the request method was POST.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.