Thanks for the clarification.

iain

On Fri, Jul 27, 2012 at 1:46 PM, Gael Pasgrimaud <[email protected]> wrote:

> On 27/07/2012 22:30, Iain Duncan wrote:
>
>>
>> On Fri, Jul 27, 2012 at 1:26 PM, Gael Pasgrimaud <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>>     On 27/07/2012 22:21, Iain Duncan wrote:
>>
>>         Hi, I'm implementing a set of views to return json to work with
>> Dojo
>>         object stores. From what I can gather, Dojo best wants me to
>>         return a
>>         204 status after a successful delete.
>>         The view is registered as using the json renderer. It changes the
>>         response status to 204 and returns None to the json renderer (or
>> an
>>         empty dict, I've tried both). Web test however is throwing an
>>         assertion
>>         error with the message that there is content with my 204 response.
>>
>>
>>     Try to return pyramid.httpexceptions.__**HTTPNoContent()
>>
>>
>>
>>
>> Thanks Gael. Is that considered better practice than doing the
>> following, which also makes it pass but seems hacky? I'm worried that if
>> I raise HTTPNoContent, is it a text/json reponse? Or is that a non issue
>> because it's a 204? ( ie are json 204s and html 204s identical? )
>>
>>
> That's a non issue because if you don't have a content you don't need a
> content-type. And you should not have one. This is why webtest raise.
>
>
>  my hacky fix:
>>   self.request.response.status = '204 No Content'
>>   self.request.response.headers.**pop('Content-Type')
>>   return None
>>
>>
> I guess the result is the same. But you can just return a Response
> instance. eg: HTTPNoContent(). No need to raise it.
>
>  thanks
>>
>> Iain
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "pylons-discuss" group.
>> To post to this group, send email to 
>> pylons-discuss@googlegroups.**com<[email protected]>
>> .
>> To unsubscribe from this group, send email to
>> pylons-discuss+unsubscribe@**googlegroups.com<pylons-discuss%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/**group/pylons-discuss?hl=en<http://groups.google.com/group/pylons-discuss?hl=en>
>> .
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To post to this group, send email to 
> pylons-discuss@googlegroups.**com<[email protected]>
> .
> To unsubscribe from this group, send email to pylons-discuss+unsubscribe@*
> *googlegroups.com <pylons-discuss%[email protected]>.
> For more options, visit this group at http://groups.google.com/**
> group/pylons-discuss?hl=en<http://groups.google.com/group/pylons-discuss?hl=en>
> .
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en.

Reply via email to