[MERGE] Enable writable http transports
Aaron Bentley
aaron.bentley at utoronto.ca
Wed Aug 30 18:38:14 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
The webdav plugin itself has a bug in testing for pycurl: if it's not
installed, it raises DependencyNotPresent, but DependencyNotPresent is
not defined. You'd need to import it from bzrlib.errors.
Actualy, you could just do this:
=== modified file 'webdav.py'
- --- webdav.py 2006-08-29 15:31:20 +0000
+++ webdav.py 2006-08-30 17:22:44 +0000
@@ -103,14 +103,9 @@
# We use bzrlib.transport.http._pycurl as our base
# implementation, so we have the same dependancies.
- -try:
- - import pycurl
- -except ImportError, e:
- - mutter("failed to import pycurl: %s", e)
- - raise DependencyNotPresent('pycurl', e)
- -
# Now we can import _pycurl
from bzrlib.transport.http._pycurl import PyCurlTransport
+import pycurl
register_urlparse_netloc_protocol('https+webdav')
register_urlparse_netloc_protocol('http+webdav')
That way, bzrlib.transport.http._pycurl will throw DependencyNotPresent
for you.
Vincent LADEUIL wrote:
> Argh. Any server where I can see that for myself ?
Well, turning directory indexes off may do it for you. We had some
problems with multiviews too, but I don't remember the details.
> But I
> would have preferred to be able to test for NoSuchFile *or*
> PathError.
assertRaises can take multiple exceptions as input, if that's what you
mean. Just pass in a tuple of exceptions as the first argument.
(this also works for "except" clauses)
> Aaron> Hmm. There may be a case for allowing users to push to http:// urls,
> Aaron> but perhaps that's for future development.
>
> Sorry I didn't understood it. Yes the aim is to provide a way to
> push to http:// urls, but I think it's a bit premature for the
> plugin to install itself as the default http transport.
Okay, so that's something to look at in the future, then.
> By the way, I'm not sure I understand how bzr choose a transport
> when several are declared for the same prefix, for example in
> transport.__init__.py there is:
>
> register_lazy_transport('http://', 'bzrlib.transport.http._urllib',
> 'HttpTransport_urllib')
> register_lazy_transport('http://', 'bzrlib.transport.http._pycurl',
> 'PyCurlTransport')
>
> Which one is chosen, where and why ?
The last-registered one is chosen, because register_transport puts it
first in the list. Since plugins are loaded after transports, this
means that transports registered by plugins will supersede built-in
transports.
You used a tab to indent here, instead of spaces. We'll fix that when
we merge it, though.
> + # read only transports never manipulate directories
> + if self.is_readonly() and relpath_parts[-1] == '':
> raise ValueError("path %r within branch %r seems to be a directory"
> % (relpath, self._path))
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFE9c0G0F+nu1YWqI0RAjHLAKCC65CjkHjBLcXfeF5y+n6hPTJrQgCeNxzU
ly7Be3A1viG/iGkPL6MJSrg=
=VoiR
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list