8000 Remove one use of UserDict.UserDict · python/cpython@2add352 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2add352

Browse files
committed
Remove one use of UserDict.UserDict
1 parent b346042 commit 2add352

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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)
0