tags:

views:

64

answers:

1

I'm vaguely doing the django tutorial.

<form action="." method="POST">
  <input type="text" name="language" value="{{ fbuser.language|escape }}" />
  <input type="submit" value="Change" />
</form>

def canvas(request):
    if request.POST != {}: assert False, request.POST

The assert never fires, and my request.POST is always {} and the page renders as if i refreshed it. I'm pretty sure my canvas is getting called because if I change the form action attribute to "foobar" I get a django error:

Page not found (404)
Request Method: POST
Request URL:    http://192.168.0.106:8000/fbsample/canvas/foobar

EDIT: I have now tried having my postback URL go to 'foobar/'. In the server log I see the post happen, but it redirects to canvas? and foobar is never called? I'm starting to suspect that the pyfacebook middleware is doing something funky, it would be helpful if you guys can confirm that this behavior is crazy...

+2  A: 

request.POST evaluates to False if it's empty, but this is not the dict object, it might not support comparison operations to ordinary dict object. It would be better if you do:

if request.POST:
    assert False
zgoda