diff options
author | Guido van Rossum <guido@python.org> | 1997-12-24 21:18:41 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-12-24 21:18:41 (GMT) |
commit | 00f9fea288baed5a37e3866b492185b5045d30d4 (patch) | |
tree | 8ecf28e2d8907d52e18f10a66e582d5d3bda92d7 /Lib/cgi.py | |
parent | b9b50eb7e09ec1b28e8549c2c90d7ed5748b3173 (diff) | |
download | cpython-00f9fea288baed5a37e3866b492185b5045d30d4.zip cpython-00f9fea288baed5a37e3866b492185b5045d30d4.tar.gz cpython-00f9fea288baed5a37e3866b492185b5045d30d4.tar.bz2 |
Use string.replace instead of regsub.[g]sub.
Diffstat (limited to 'Lib/cgi.py')
-rwxr-xr-x | Lib/cgi.py | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -420,7 +420,6 @@ import string import sys import os import urllib -import regsub import mimetools import rfc822 from StringIO import StringIO @@ -564,8 +563,8 @@ def parse_qs(qs, keep_blank_values=0, strict_parsing=0): if strict_parsing: raise ValueError, "bad query field: %s" % `name_value` continue - name = urllib.unquote(regsub.gsub('+', ' ', nv[0])) - value = urllib.unquote(regsub.gsub('+', ' ', nv[1])) + name = urllib.unquote(string.replace(nv[0], '+', ' ')) + value = urllib.unquote(string.replace(nv[1], '+', ' ')) if len(value) or keep_blank_values: if dict.has_key (name): dict[name].append(value) @@ -1317,11 +1316,11 @@ environment as well. Here are some common variable names: def escape(s, quote=None): """Replace special characters '&', '<' and '>' by SGML entities.""" - s = regsub.gsub("&", "&", s) # Must be done first! - s = regsub.gsub("<", "<", s) - s = regsub.gsub(">", ">", s) + s = string.replace(s, "&", "&") # Must be done first! + s = string.replace(s, "<", "<") + s = string.replace(s, ">", ">",) if quote: - s = regsub.gsub('"', """, s) + s = string.replace(s, '"', """) return s |