Skip to content

Commit 07f852b

Browse files
author
raymond.hettinger
committed
Remove one use of UserDict.UserDict
git-svn-id: http://svn.python.org/projects/python/branches/py3k@60580 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 04f6f42 commit 07f852b

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

Lib/cgi.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
import urllib
4141
import mimetools
4242
import rfc822
43-
import UserDict
43+
import collections
4444
from io import StringIO
4545

4646
__all__ = ["MiniFieldStorage", "FieldStorage", "FormContentDict",
@@ -781,7 +781,7 @@ def make_file(self):
781781
# Backwards Compatibility Classes
782782
# ===============================
783783

784-
class FormContentDict(UserDict.UserDict):
784+
class FormContentDict(collections.Mapping):
785785
"""Form content as dictionary with a list of values per field.
786786
787787
form = FormContentDict()
@@ -800,6 +800,15 @@ def __init__(self, environ=os.environ, keep_blank_values=0, strict_parsing=0):
800800
strict_parsing=strict_parsing)
801801
self.query_string = environ['QUERY_STRING']
802802

803+
def __len__(self):
804+
return len(self.dict)
805+
806+
def __iter__(self):
807+
return iter(self.dict)
808+
809+
def __getitem__(self, key):
810+
return self.dict[key]
811+
803812

804813
class SvFormContentDict(FormContentDict):
805814
"""Form content as dictionary expecting a single value per field.

0 commit comments

Comments
 (0)