summaryrefslogtreecommitdiffstats
path: root/Lib/cgi.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-12-09 22:16:46 (GMT)
committerGuido van Rossum <guido@python.org>1998-12-09 22:16:46 (GMT)
commit030d2ec16c547d97abb3367e658faf92147c8d00 (patch)
treefc15b8f8c5045b5ac8580d147ec7dcf4ed108926 /Lib/cgi.py
parentf8b3b944aa748be7689109c353e990e8a25c684f (diff)
downloadcpython-030d2ec16c547d97abb3367e658faf92147c8d00.zip
cpython-030d2ec16c547d97abb3367e658faf92147c8d00.tar.gz
cpython-030d2ec16c547d97abb3367e658faf92147c8d00.tar.bz2
In read_multi, allow a subclass to override the class we instantiate
when we create a recursive instance, by setting the class variable 'FieldStorageClass' to the desired class. By default, this is set to None, in which case we use self.__class__ (as before).
Diffstat (limited to 'Lib/cgi.py')
-rwxr-xr-xLib/cgi.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/cgi.py b/Lib/cgi.py
index aaaded5..108310e 100755
--- a/Lib/cgi.py
+++ b/Lib/cgi.py
@@ -919,16 +919,19 @@ class FieldStorage:
self.list.append(MiniFieldStorage(key, value))
self.skip_lines()
+ FieldStorageClass = None
+
def read_multi(self, environ, keep_blank_values, strict_parsing):
"""Internal: read a part that is itself multipart."""
self.list = []
- part = self.__class__(self.fp, {}, self.innerboundary,
- environ, keep_blank_values, strict_parsing)
+ klass = self.FieldStorageClass or self.__class__
+ part = klass(self.fp, {}, self.innerboundary,
+ environ, keep_blank_values, strict_parsing)
# Throw first part away
while not part.done:
headers = rfc822.Message(self.fp)
- part = self.__class__(self.fp, headers, self.innerboundary,
- environ, keep_blank_values, strict_parsing)
+ part = klass(self.fp, headers, self.innerboundary,
+ environ, keep_blank_values, strict_parsing)
self.list.append(part)
self.skip_lines()