summaryrefslogtreecommitdiff
path: root/paste/util/quoting.py
diff options
context:
space:
mode:
authorianb <devnull@localhost>2005-12-13 07:00:20 +0000
committerianb <devnull@localhost>2005-12-13 07:00:20 +0000
commit4e73bff9da87e35c7154ab1cc923bb4f9d40711d (patch)
treed2e4c92965398700457280d5829dfaa5cdf5b4fb /paste/util/quoting.py
parent55b404e53bc834daf3852069af6de9b1fca4c742 (diff)
downloadpaste-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.py10
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('&nbsp;', ' ').replace('&lt;', '<')
+ s = s.replace('&gt;', '>').replace('&amp;','&')
+ return s
+
url_quote = urllib.quote
url_unquote = urllib.unquote