[merge] MVC progress bars, and indication of network traffic
John Arbash Meinel
john at arbash-meinel.com
Wed Dec 17 14:58:52 GMT 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
...
> martin> :param relpath: The relative path to the file
> martin> """
> martin> - return self.get(relpath).read()
> martin> + f = self.get(relpath)
> martin> + try:
> martin> + return f.read()
> martin> + finally:
> martin> + f.close()
>
>
> EErk ! I'm pretty sure you just closed the http socket here (the
> http transport doesn't redefine get_bytes) ! If no test is
> failing there, we need one. On the other hand, I'm not sure you
> need that part in your patch.
>
Unless something has changed, HTTPTransport.get() does:
code, response_file = self._get(relpath, None)
# FIXME: some callers want an iterable... One step forward, three steps
# backwards :-/ And not only an iterable, but an iterable that can be
# seeked backwards, so we will never be able to do that. One such
# known client is bzrlib.bundle.serializer.v4.get_bundle_reader. At the
# time of this writing it's even the only known client -- vila20071203
return StringIO(response_file.read())
Mostly I'm pointing that we don't return the raw socket, we wrap it in a
StringIO.
Originally we needed that because "gzip.py" does a seek() on its input,
but we changed that in "tuned_gzip.py"
So it is possible you might change it at some point in the future,
though I think not dealing in a raw socket may work out best for
everyone. (For example, making sure all the bytes are consumed before
the next request is sent.)
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAklJE6wACgkQJdeBCYSNAAP6/ACdEVsgkGdDrRRvnVqJ55ImLC8O
/BkAn1xtbkoaAOoa5OFqQBDTYwxi2x0l
=xdr6
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list