[Python-3000-checkins] r60580 - python/branches/py3k/Lib/cgi.py

raymond.hettinger python-3000-checkins at python.org
Mon Feb 4 23:43:28 CET 2008


Author: raymond.hettinger
Date: Mon Feb  4 23:43:27 2008
New Revision: 60580

Modified:
   python/branches/py3k/Lib/cgi.py
Log:
Remove one use of UserDict.UserDict

Modified: python/branches/py3k/Lib/cgi.py
==============================================================================
--- python/branches/py3k/Lib/cgi.py	(original)
+++ python/branches/py3k/Lib/cgi.py	Mon Feb  4 23:43:27 2008
@@ -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.


More information about the Python-3000-checkins mailing list