~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/http/_pycurl.py

  • Committer: Martin Pool
  • Date: 2006-03-06 07:21:48 UTC
  • mto: This revision was merged to the branch mainline in revision 1611.
  • Revision ID: mbp@sourcefrog.net-20060306072148-d7a8823cc828da7f
[broken] keep hooking pycurl into test framework

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
                           TransportError, ConnectionError,
26
26
                           DependencyNotPresent)
27
27
from bzrlib.transport import Transport
28
 
from bzrlib.transport.http import HttpTransportBase
 
28
from bzrlib.transport.http import HttpTransportBase, extract_auth, HttpServer
29
29
 
30
30
try:
31
31
    import pycurl
48
48
        super(PyCurlTransport, self).__init__(base)
49
49
        mutter('using pycurl %s' % pycurl.version)
50
50
 
 
51
    def should_cache(self):
 
52
        """Return True if the data pulled across should be cached locally.
 
53
        """
 
54
        return True
 
55
 
51
56
    def has(self, relpath):
52
57
        self.curl = pycurl.Curl()
53
58
 
54
59
        abspath = self.abspath(relpath)
55
60
        if isinstance(abspath, unicode):
56
 
            raise ValueError("paths passed to Transport must be plain strings: "
57
 
                    + `abspath`)
 
61
            abspath = abspath.encode('ascii', 'strict')
 
62
        #     raise ValueError("paths passed to Transport must be plain strings: "
 
63
        #             + `abspath`)
58
64
        self.curl.setopt(pycurl.URL, abspath)
59
65
        self._set_curl_cache_headers()
60
66
        # don't want the body - ie just do a HEAD request
118
124
                raise NoSuchFile(self.curl.getinfo(pycurl.EFFECTIVE_URL), e)
119
125
 
120
126
 
 
127
 
 
128
def get_test_permutations():
 
129
    """Return the permutations to be used in testing."""
 
130
    return [(PyCurlTransport, HttpServer),
 
131
            ]