Attachment() namedtuple, encode_attachement()
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Microfiber |
Fix Released
|
High
|
Jason Gerard DeRose |
Bug Description
namedtuple are pretty darn handy, so I'm adding an Attachment(
CouchBase.get_att() will now return an Attachment rather than a vanilla tuple. This doesn't break the API as the namedtuple works just like a regular tuple when used like one. But the `content_type` and `data` attributes are nice.
I'm also adding an encode_attachment() function as I have equivalent code in Dmedia in a few places and it makes sense to consolidate this is Microfiber.
The function sig is:
encode_
Where *attachment* is an Attachment namedtuple. I have somewhat mixed feelings about this, but I like the fact that it makes round-tripping easy without intermediate code having to unpack the (content_type, data) all the time, or know any details about the attachment data structure. The equivalent function in Dmedia is currently:
encode_
Lastly, I'm adding an experimental CouchBase.
CouchBase.
CouchBase.
The rational is similar as for encode_
To clarify, this bug itself involves *no* API breakage. If it seems like a good idea, CouchBase.put_att() will be changed in a separate merge. Regardless, CouchBase.
Related branches
- David Jordan: Approve
-
Diff: 162 lines (+89/-7)2 files modifiedmicrofiber.py (+35/-1)
test_microfiber.py (+54/-6)
Changed in microfiber: | |
status: | In Progress → Fix Committed |
Changed in microfiber: | |
status: | Fix Committed → Fix Released |
status: | Fix Released → Fix Committed |
Changed in microfiber: | |
status: | Fix Committed → Fix Released |