summaryrefslogtreecommitdiffstats
path: root/Lib/cgi.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-12-24 21:18:41 (GMT)
committerGuido van Rossum <guido@python.org>1997-12-24 21:18:41 (GMT)
commit00f9fea288baed5a37e3866b492185b5045d30d4 (patch)
tree8ecf28e2d8907d52e18f10a66e582d5d3bda92d7 /Lib/cgi.py
parentb9b50eb7e09ec1b28e8549c2c90d7ed5748b3173 (diff)
downloadcpython-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-xLib/cgi.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/Lib/cgi.py b/Lib/cgi.py
index fb3076c..e4cb217 100755
--- a/Lib/cgi.py
+++ b/Lib/cgi.py
@@ -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("&", "&amp;", s) # Must be done first!
- s = regsub.gsub("<", "&lt;", s)
- s = regsub.gsub(">", "&gt;", s)
+ s = string.replace(s, "&", "&amp;") # Must be done first!
+ s = string.replace(s, "<", "&lt;")
+ s = string.replace(s, ">", "&gt;",)
if quote:
- s = regsub.gsub('"', "&quot;", s)
+ s = string.replace(s, '"', "&quot;")
return s