~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2010-10-13 08:01:36 UTC
  • mfrom: (5447.5.1 config-read)
  • mto: This revision was merged to the branch mainline in revision 5499.
  • Revision ID: v.ladeuil+lp@free.fr-20101013080136-7o5qbbwgxhgncsj8
Merge config-read into config-modify

Show diffs side-by-side

added added

removed removed

Lines of Context:
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]