4

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.

julx
  • 8,694
  • 6
  • 47
  • 86

1 Answers1

3

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.

julx
  • 8,694
  • 6
  • 47
  • 86
  • Well, problem is, since then I switched to other library (tastypie), but as I recall it was the line that registers the parser for the specified content type. I changed content type from "json" to "json; charser-utf-8" and it ticked. If you had trouble finding it, I could dig into my past commits. – julx Aug 12 '11 at 13:05
  • Ah, that's easy. I assumed you were doing something with the BAD_REQUEST. Thanks! – Dolph Aug 14 '11 at 03:45