]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Remove one use of UserDict.UserDict
authorRaymond Hettinger <python@rcn.com>
Mon, 4 Feb 2008 22:43:27 +0000 (22:43 +0000)
committerRaymond Hettinger <python@rcn.com>
Mon, 4 Feb 2008 22:43:27 +0000 (22:43 +0000)
Lib/cgi.py

index cb92cfc77baff2168adc0b1ce9fec46936bcb509..01a28fe4b646e6ee50d21558b1ddb9fd2974e059 100755 (executable)
@@ -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.