[Zope-dev] What does a "no Content-Type" traceback indicate is wrong?

skip@mojam.com (Skip Montanaro) skip@mojam.com (Skip Montanaro)
Mon, 12 Apr 1999 12:44:06 -0400


I'm looking for a little advice.  I stuck a little sendmail block at the
start of Response._traceback:

    def _traceback(self,t,v,tb):
        if t != "NotFound":
            import traceback, os
            msg = os.popen('/usr/sbin/sendmail -t', 'w')
            msg.write('To: skip@musi-cal.com\n')
            msg.write('Subject: Z traceback\n\n')
            traceback.print_tb(tb, None, msg)
            msg.write("%s: %s\n" % (t, v))
            msg.close()
        
        tb=self.format_exception(t,v,tb,200)
        tb=join(tb,'\n')
        tb=self.quoteHTML(tb)
        return "\n%s\n%s\n%s" % (_tbopen, tb, _tbclose)

I expect to use this mostly as a sanity check on my own changes.  (If I
introduce any bugs, I get a bunch of email.  How apropos...)

There are three types of tracebacks popping up frequently in my email at the
moment.  One is the ubiquitous "NotFound" error (which, as you can see
above, I toss).  A second common traceback indicates a user failed to fill
in one or more required fields in a form.  I will probably eliminate it from
considerations as well.

The third traceback I see frequently looks like

  File "/home/killer-whale/skip/src/Zope-1.9.0-src/lib/python/ZPublisher/Publish.py", line 872, in publish_module
    publisher = ModulePublisher(
  File "/home/killer-whale/skip/src/Zope-1.9.0-src/lib/python/ZPublisher/Publish.py", line 163, in __init__
    fs=FieldStorage(fp=fp,environ=environ,keep_blank_values=1)
  File "/usr/local/lib/python1.5/cgi.py", line 846, in __init__
    ctype, pdict = parse_header(self.headers['content-type'])
  File "/usr/local/lib/python1.5/cgi.py", line 690, in parse_header
    plist = map(string.strip, string.splitfields(line, ';'))
  exceptions.TypeError: argument 1: expected read-only buffer, None found

This indicates the input was missinf a Content-Type header.  Are there any
valid circumstances under which this might occur?  Does this just represent
a broken browser or communication-challenged connection?  Can I fake a
content type and continue or is it a lost cause at this point because
something more tragic will likely happen further down the line?

Thx,

Skip Montanaro	| Mojam: "Uniting the World of Music" http://www.mojam.com/
skip@mojam.com  | Musi-Cal: http://www.musi-cal.com/
518-372-5583