diff options
author | ianb <devnull@localhost> | 2005-12-13 07:00:20 +0000 |
---|---|---|
committer | ianb <devnull@localhost> | 2005-12-13 07:00:20 +0000 |
commit | 4e73bff9da87e35c7154ab1cc923bb4f9d40711d (patch) | |
tree | d2e4c92965398700457280d5829dfaa5cdf5b4fb /paste/util/quoting.py | |
parent | 55b404e53bc834daf3852069af6de9b1fca4c742 (diff) | |
download | paste-4e73bff9da87e35c7154ab1cc923bb4f9d40711d.tar.gz |
Merged changes from cce branch (r3727:HEAD/4008); the branch is now in sync with trunk
Diffstat (limited to 'paste/util/quoting.py')
-rw-r--r-- | paste/util/quoting.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/paste/util/quoting.py b/paste/util/quoting.py index d029518..5f42e6a 100644 --- a/paste/util/quoting.py +++ b/paste/util/quoting.py @@ -6,7 +6,8 @@ import htmlentitydefs import urllib import re -__all__ = ['html_quote', 'html_unquote', 'url_quote', 'url_unquote'] +__all__ = ['html_quote', 'html_unquote', 'url_quote', 'url_unquote', + 'strip_html'] default_encoding = 'UTF-8' @@ -59,6 +60,13 @@ def html_unquote(s, encoding=None): s = s.decode(encoding or default_encoding) return _unquote_re.sub(_entity_subber, s) +def strip_html(s): + # should this use html_unquote? + s = re.sub('<.*?>', '', s) + s = s.replace(' ', ' ').replace('<', '<') + s = s.replace('>', '>').replace('&','&') + return s + url_quote = urllib.quote url_unquote = urllib.unquote |