How do you know it is executing? Perhaps request.POST['var']
is also ''
so you couldn't tell the difference.
Also, the only way that
var = request.POST['var']
could raise a NameError
is if request
doesn't exist.
If request.POST
doesn't exist, means POST
doesn't exist as an attribute of request
thus raising AttributeError
instead, and if request.POST['var']
doesn't exist, means 'var'
is not a key of request.POST
thus raising KeyError
instead.
EDIT:
My guess is that you're not sending a POST
. But can't know for sure.