[merge] Transport.{append,get,put}_bytes

John Arbash Meinel john at arbash-meinel.com
Thu Aug 24 20:32:11 BST 2006


Attached is a patch which implements and tests 3 new functions on
Transport. append_bytes, get_bytes, and put_bytes.

There is a base-level implementation which just takes the bytes, and
wraps them in a cStringIO.StringIO() object, and calls the normal
function. This means that all Transports already have them implemented,
and can chose if they want to special case it.

It also fixes a couple of calls where we were passing a string to
'put()' rather than passing a file-like object.

The biggest benefit for us is that we have a lot of calls that already
have a string in memory, and it is a lot of busy work for all of those
locations to wrap their strings in StringIO().

Also, we would like to deprecate put() taking strings, but that needs to
wait until the next release. This release just gives us the alternative,
and we can do the deprecation dance later.

I also cleaned up the put and append tests. We had a lot of bogus
redundancy because I wrote the tests a long time ago, when I didn't
write simple tests. :) Also, at one point append() allowed both strings
and file-like objects, but that api was de-magicked a while ago. 'put()'
was intended to be de-magicked, but we obviously didn't do it thoroughly.

On IRC, Robert thought this could be +1 for 0.10, since it is a
relatively small api extension, with no loss of functionality.

Also, we probably want to deprecated the get_multi, put_multi, and
append_multi (copy_multi?) apis. They never caught on, so right now the
only thing using them is the test suite. (delete_multi and mkdir_multi
*are* used, but probably could be replaced)

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: transport_bytes.patch
Type: text/x-patch
Size: 39991 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060824/bf9ae150/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060824/bf9ae150/attachment.pgp 


More information about the bazaar mailing list