~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/HTTPTestUtil.py

  • Committer: Alexander Belchenko
  • Date: 2007-01-02 12:40:19 UTC
  • mto: This revision was merged to the branch mainline in revision 2221.
  • Revision ID: bialix@ukr.net-20070102124019-0qknbaxgbdxnkfhb
Fix generation of rstx man page (problem with short names of options) and provide simple tests for future.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import errno
19
19
from SimpleHTTPServer import SimpleHTTPRequestHandler
20
20
import socket
21
 
import urlparse
22
21
 
23
22
from bzrlib.tests import TestCaseWithTransport
24
23
from bzrlib.tests.HttpServer import (
207
206
    """Append a '-proxied' suffix to file served"""
208
207
 
209
208
    def translate_path(self, path):
210
 
        # We need to act as a proxy and accept absolute urls,
211
 
        # which SimpleHTTPRequestHandler (grand parent) is not
212
 
        # ready for. So we just drop the protocol://host:port
213
 
        # part in front of the request-url (because we know we
214
 
        # would not forward the request to *another* proxy).
215
 
 
216
 
        # So we do what SimpleHTTPRequestHandler.translate_path
217
 
        # do beginning with python 2.4.3: abandon query
218
 
        # parameters, scheme, host port, etc (which ensure we
219
 
        # provide the right behaviour on all python versions).
220
 
        path = urlparse.urlparse(path)[2]
221
 
        # And now, we can apply *our* trick to proxy files
222
 
        self.path += '-proxied'
223
 
        # An finally we leave our mother class do whatever it
224
 
        # wants with the path
225
 
        return TestingHTTPRequestHandler.translate_path(self, path)
226
 
 
 
209
        return TestingHTTPRequestHandler.translate_path(self,
 
210
                                                        path + '-proxied')
227
211
 
228
212