/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
        else:
170
170
            # TODO: Don't call this with an array - no magic interfaces
171
171
            relpath_parts = relpath[:]
172
 
 
173
172
        if relpath.startswith('/'):
174
173
            basepath = []
175
174
        else:
283
282
 
284
283
        return combined
285
284
 
286
 
    def put(self, relpath, f, mode=None):
287
 
        """Copy the file-like or string object into the location.
 
285
    def put_file(self, relpath, f, mode=None):
 
286
        """Copy the file-like object into the location.
288
287
 
289
288
        :param relpath: Location to put the contents, relative to base.
290
 
        :param f:       File-like or string object.
 
289
        :param f:       File-like object.
291
290
        """
292
291
        raise TransportNotPossible('http PUT not supported')
293
292
 
299
298
        """See Transport.rmdir."""
300
299
        raise TransportNotPossible('http does not support rmdir()')
301
300
 
302
 
    def append(self, relpath, f):
 
301
    def append_file(self, relpath, f, mode=None):
303
302
        """Append the text in the file-like object into the final
304
303
        location.
305
304
        """
448
447
        if not self.parse_request(): # An error code has been sent, just exit
449
448
            return
450
449
        mname = 'do_' + self.command
451
 
        if not hasattr(self, mname):
 
450
        if getattr(self, mname, None) is None:
452
451
            self.send_error(501, "Unsupported method (%r)" % self.command)
453
452
            return
454
453
        method = getattr(self, mname)
496
495
    # used to form the url that connects to this server
497
496
    _url_protocol = 'http'
498
497
 
 
498
    # Subclasses can provide a specific request handler
 
499
    def __init__(self, request_handler=TestingHTTPRequestHandler):
 
500
        Server.__init__(self)
 
501
        self.request_handler = request_handler
 
502
 
499
503
    def _http_start(self):
500
504
        httpd = None
501
505
        httpd = TestingHTTPServer(('localhost', 0),
502
 
                                  TestingHTTPRequestHandler,
 
506
                                  self.request_handler,
503
507
                                  self)
504
508
        host, port = httpd.socket.getsockname()
505
509
        self._http_base_url = '%s://localhost:%s/' % (self._url_protocol, port)
560
564
        
561
565
    def get_bogus_url(self):
562
566
        """See bzrlib.transport.Server.get_bogus_url."""
563
 
        # this is chosen to try to prevent trouble with proxies, wierd dns,
 
567
        # this is chosen to try to prevent trouble with proxies, weird dns,
564
568
        # etc
565
569
        return 'http://127.0.0.1:1/'
566
570