lanto03 / couchdb-python

Automatically exported from code.google.com/p/couchdb-python
Other
0 stars 0 forks source link

application/json attachments are returned as Python objects #114

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a document.
2. Put an attachment with type 'application/json'.
3. Get the attachment.

What is the expected output? What do you see instead?
Attachment data should be bytes but couchdb.http deserialises the content 
and returns a Python object.

Original issue reported on code.google.com by matt.goo...@gmail.com on 10 Feb 2010 at 3:00

GoogleCodeExporter commented 8 years ago
Why do you think we should change this? Just for consistency? I suspect that, 
if we
really want to be consistent in the http layer, we should only decode in client.

Original comment by djc.ochtman on 10 Feb 2010 at 3:11

GoogleCodeExporter commented 8 years ago
Sidetracked by work for a while ... here's the test for it.

Original comment by matt.goo...@gmail.com on 10 Feb 2010 at 4:12

Attachments:

GoogleCodeExporter commented 8 years ago
Attachments mean nothing to couchdb - they're just blobs of data with a content 
type - so 
they should be passed straight through to the application to handle.

It's not about consistency. Imagine some dumb proxy-style application that's 
blindly 
grabbing attachments from CouchDB and sending them on somewhere else in a 
typical while ... 
read ... write loop. If it comes across an attachment that just happens to be 
'attachment/json' then it will break.

Yes, I think the decoding should only happen in the client module, i.e. where 
the meaning of 
the data is understood. (We could pass an option through to request() to make 
things easy 
but that seems a bit dirty.)

Original comment by matt.goo...@gmail.com on 10 Feb 2010 at 4:24

GoogleCodeExporter commented 8 years ago
Fixed in r14e447ce4e.

Original comment by matt.goo...@gmail.com on 20 Feb 2010 at 6:49