Broken PUT request with jquery/python GAE

32 views
Skip to first unread message

Alexander Zylman

unread,
Aug 10, 2011, 11:40:22 PM8/10/11
to google-a...@googlegroups.com
I'm using jQuery's AJAX function, like so:

    $.ajax ({ "url" : "/note",
        "async" : true,
        "type" : "POST",
        "data" : {"id" : id, "content" : el.value}
      });

On the backend (Python Google App Engine, currently using webapp.RequestHandler), PUT requests are handled by the same function that handles POST requests.

If I make a POST request everything works. If I change it to a PUT request (by changing type of the AJAX call), nothing works. If I check the logs for GAE, I see:

    BadKeyError: Invalid string key .

This is the result of logging the ID for each call:

    ID: ahFkZXZ-YXp2ZC13ZWJub3Rlc3ItCxIKU3RpY2t5Tm90ZSIQdGVzdEBleGFtcGxlLmNvbQwLEgdzbk1vZGVsGAIM (from the POST call)
    ID: (from the PUT call)

So clearly it's not passing the ID properly for PUT calls, which is why the datastore is giving me a BadKeyError. I'm not sure if this is a problem on jQuery's side, or if it's from GAE's side, though, and I have no idea what's going on. Any help would be appreciated.

Robert Kluin

unread,
Aug 12, 2011, 1:44:25 AM8/12/11
to google-a...@googlegroups.com
Probably due to issue 170:
http://code.google.com/p/googleappengine/issues/detail?id=170

When debugging stuff like this, don't forget to try logging things
like the raw request body. It will help you out a bunch.

Robert

> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/z__ZZGXZAIwJ.
> To post to this group, send email to google-a...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengi...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>

Reply all
Reply to author
Forward
0 new messages