Search code examples
djangojsonrestpostdjango-piston

Django Piston forks confusion


I've noticed that there are about 30 forks of Django Piston on GitHub:

https://github.com/search?q=django-piston&type=Everything&repo=&langOverride=&start_value=1

My problem with that framework is that both 0.2.2 and 0.2.1 versions seem not to populate request.data field appropriately when I send data through POST + application/json. I'm pretty certain that the problem exists, I spent a lot of time testing it. Also I've seen some tickets complaining about the same issue (if I understand the complaints correctly).

My question is: to all the Django Piston users - which versions do you use and find the most stable. Does request.data field work correctly for you.

EDIT:

Wow, actually there are ~140 forks on BitBucket... https://bitbucket.org/jespern/django-piston/descendants

EDIT(2):

Actually, after having tried Piston for quite some time - I have to say - its codebase is pretty messy. Could be messier, but it's not exactly self-explanatory. Moreover it has a few horrendous ideas, most of which have to do with global variables. After tracking a few bugs that turned out to have their roots in some bizarre design decisions in Piston, I finally turned my back on it and now moved on to TastyPie. Had no problems ever since.


Solution

  • Well finally tracked that down. Must learn to view sources earlier, as the issue proved not to be that serious. Well, jQuery always appends "; charset=utf-8" to the end of the request. On the other hand Piston assumes that the MIME type matches exactly the registered name. In other case it raises BAD_REQUEST. One minor correction inside utils.py, and everything works again as expected.