summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-02-04 22:43:27 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-02-04 22:43:27 (GMT)
commit2add352c435f8973274f16c37eb6246f86799722 (patch)
tree4e40b04c9c0e24ef6c7779001297aaba9156e740
parentb34604233ad9e27c99975d8d3f77e633b2b3a866 (diff)
downloadcpython-2add352c435f8973274f16c37eb6246f86799722.zip
cpython-2add352c435f8973274f16c37eb6246f86799722.tar.gz
cpython-2add352c435f8973274f16c37eb6246f86799722.tar.bz2
Remove one use of UserDict.UserDict
-rwxr-xr-xLib/cgi.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/Lib/cgi.py b/Lib/cgi.py
index cb92cfc..01a28fe 100755
--- a/Lib/cgi.py
+++ b/Lib/cgi.py
@@ -40,7 +40,7 @@ import os
import urllib
import mimetools
import rfc822
-import UserDict
+import collections
from io import StringIO
__all__ = ["MiniFieldStorage", "FieldStorage", "FormContentDict",
@@ -781,7 +781,7 @@ class FieldStorage:
# Backwards Compatibility Classes
# ===============================
-class FormContentDict(UserDict.UserDict):
+class FormContentDict(collections.Mapping):
"""Form content as dictionary with a list of values per field.
form = FormContentDict()
@@ -800,6 +800,15 @@ class FormContentDict(UserDict.UserDict):
strict_parsing=strict_parsing)
self.query_string = environ['QUERY_STRING']
+ def __len__(self):
+ return len(self.dict)
+
+ def __iter__(self):
+ return iter(self.dict)
+
+ def __getitem__(self, key):
+ return self.dict[key]
+
class SvFormContentDict(FormContentDict):
"""Form content as dictionary expecting a single value per field.