On Mar 17, 2012, at 12:07 PM, Rotem Tamir wrote:

> it appears that
> 
> from simplejson import loads
> kw = loads(request.body)
> 
> works.
> 
> however, i believe that this should just work as if it were a normal
> POST request, no?

No, I don't think so. One could argue that this should be the case, but AFAIK 
there is no machinery in TG that does this for you.


Diez


> 
> On Mar 16, 6:05 pm, Rotem Tamir <[email protected]> wrote:
>> Hi everyone,
>> 
>> I'm using backbone.js on the front to build the user interface, and my
>> favorite framework on the backend, turbogears 2.1.
>> 
>> I have a controller method for handling object updates by backbone.
>> Backbone sends object updates as PUT requests (following RESTful
>> conventions).  This is my handler:
>> 
>>     @expose('json')
>>     def tasks(self,id=None,**kw):
>>         method = request.environ['REQUEST_METHOD']
>> 
>>         if id:
>>             obj = DBSession.query(Task).filter_by(id=id).first()
>>         else:
>>             return dict()
>> 
>>         if method=='PUT' and id:
>>             print "PUT"
>>             print kw
>> 
>> Everything works fine, except "kw" is an empty dict.  I have tried
>> looking inside request.environ to find where I can find my params,
>> which are definatly being sent (I am monitoring my HTTP requests with
>> firebug.)
>> 
>> I tried to read the RestfulControllers source for clues, but haven't
>> found any.
>> 
>> Any clues?
>> 
>> Thanks,
>> 
>> Rotem Tamir
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TurboGears" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/turbogears?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to