Kaydet (Commit) 97b2fa22 authored tarafından Skip Montanaro's avatar Skip Montanaro

Bring cgi.escape docstring slightly more in line with the library ref

manual.  Closes #1243553.
üst 0d6615fd
...@@ -1041,7 +1041,9 @@ environment as well. Here are some common variable names: ...@@ -1041,7 +1041,9 @@ environment as well. Here are some common variable names:
# ========= # =========
def escape(s, quote=None): def escape(s, quote=None):
"""Replace special characters '&', '<' and '>' by SGML entities.""" '''Replace special characters "&", "<" and ">" to HTML-safe sequences.
If the optional flag quote is true, the quotation mark character (")
is also translated.'''
s = s.replace("&", "&amp;") # Must be done first! s = s.replace("&", "&amp;") # Must be done first!
s = s.replace("<", "&lt;") s = s.replace("<", "&lt;")
s = s.replace(">", "&gt;") s = s.replace(">", "&gt;")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment