From a34762ab857cc7e2fd37ac84ca5ccf58b2cfcbe6 Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Fri, 8 Jan 1999 06:04:22 +0000 Subject: Changes to workaround some bogus clients which either don't include a content-type header, or include a bogus one. cgi.py FieldStorage.__init__(): if there is no content-type header, use text/plain for inner parts, but application/x-www-form-urlencoded for outer parts. Honor any existing content-type header. Lower down, if the content-type header is something we don't understand, default to text/plain for inner parts, but application/x-www-form-urlencoded for outer parts. This patch will be proposed for Python 1.5.2 driver run_main(): Play some games to get Mailman's special cgi.py module. We import it from Mailman.pythonlib.cgi, but then we jam this module into sys.modules['cgi'] so all those imports in all those Mailman.Cgi scripts get our special one (without having to hack all those scripts!) --- scripts/driver | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'scripts/driver') diff --git a/scripts/driver b/scripts/driver index 8b5c9a2a5..c09f2f576 100644 --- a/scripts/driver +++ b/scripts/driver @@ -87,6 +87,16 @@ def run_main(): manual_reprime=1, nofail=0, immediate=1) + # pre-load the `cgi' module. we do this because we're distributing a + # slightly different version than the standard Python module. it's + # essentially Python 1.5.2's module, with an experimental patch to + # handle clients that give bogus or non-existant content-type headers. + # + # we assign sys.modules['cgi'] to this special cgi module because we + # don't want to have to rewrite all the Mailman.Cgi modules to get the + # special one. + import Mailman.pythonlib.cgi + sys.modules['cgi'] = Mailman.pythonlib.cgi # The name of the module to run is passed in argv[1]. What we # actually do is import the module named by argv[1] that lives in the # Mailman.Cgi package. That module must have a main() function, which -- cgit v1.2.3-70-g09d2