diff options
-rwxr-xr-x | Lib/cgi.py | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1316,12 +1316,14 @@ environment as well. Here are some common variable names: # Utilities # ========= -def escape(s): +def escape(s, quote=None): """Replace special characters '&', '<' and '>' by SGML entities.""" import regsub s = regsub.gsub("&", "&", s) # Must be done first! s = regsub.gsub("<", "<", s) s = regsub.gsub(">", ">", s) + if quote: + s = regsub.gsub('"', """, s) return s |