~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
from bzrlib import (
31
31
    debug,
32
32
    errors,
 
33
    transport,
33
34
    ui,
34
35
    urlutils,
35
36
    )
41
42
from bzrlib.transport import (
42
43
    ConnectedTransport,
43
44
    _CoalescedOffset,
44
 
    get_transport,
45
45
    Transport,
46
46
    )
47
47
 
570
570
                                            self._user, self._password,
571
571
                                            host, port,
572
572
                                            base_path)
573
 
                new_transport = get_transport(new_url)
 
573
                new_transport = transport.get_transport(new_url)
574
574
        else:
575
575
            # Redirected to a different protocol
576
576
            new_url = self._unsplit_url(scheme,
577
577
                                        user, password,
578
578
                                        host, port,
579
579
                                        base_path)
580
 
            new_transport = get_transport(new_url)
 
580
            new_transport = transport.get_transport(new_url)
581
581
        return new_transport
582
582
 
583
583
 
666
666
    def _finished_reading(self):
667
667
        """See SmartClientMediumRequest._finished_reading."""
668
668
        pass
 
669
 
 
670
 
 
671
def unhtml_roughly(maybe_html, length_limit=1000):
 
672
    """Very approximate html->text translation, for presenting error bodies.
 
673
 
 
674
    :param length_limit: Truncate the result to this many characters.
 
675
 
 
676
    >>> unhtml_roughly("<b>bad</b> things happened\\n")
 
677
    ' bad  things happened '
 
678
    """
 
679
    return re.subn(r"(<[^>]*>|\n|&nbsp;)", " ", maybe_html)[0][:length_limit]