开发者

django-piston: request.data availability within DELETE handlers

django-piston appears to create a data attribute on the request object before it gets to the Handler phas开发者_StackOverflow社区e. This data is available, for example, in the PUT and POST handlers by accessing request.data.

However, in the DELETE handler, the data is not available.

I would like to modify django-piston to make this data available but I have no real idea on where to start. Any ideas? Where does the data attribute originate from?


I solved this for myself. The short hacky answer is that the method

translate_mime(request)

from piston.utils needs to be run on the request to make the data attribute available.

The overall fix for this would be to make a change in the Piston source code itself in resource.py to execute the translate_mime method for DELETE actions. Currently it only does to automatically for PUT and POST.

But, like I said, you can actually just manually call translate_mime in the actual handler method and it works fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜