diff Lib/cgi.py @ 45156:1f87ec991e59

Remove one use of UserDict.UserDict
author Raymond Hettinger <python@rcn.com>
date Mon, 04 Feb 2008 22:43:27 +0000
parents 0c8fec76111c
children e94574455d9d
line wrap: on
line diff
--- a/Lib/cgi.py	Mon Feb 04 22:09:30 2008 +0000
+++ b/Lib/cgi.py	Mon Feb 04 22:43:27 2008 +0000
@@ -40,7 +40,7 @@
 import urllib
 import mimetools
 import rfc822
-import UserDict
+import collections
 from io import StringIO
 
 __all__ = ["MiniFieldStorage", "FieldStorage", "FormContentDict",
@@ -781,7 +781,7 @@
 # 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 @@
                                       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.