What does a "no Content-Type" traceback indicate is wrong?
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
Hi Skip - On Mon, 12 Apr 1999 skip@mojam.com wrote:
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)
What a useful hack! Thanks.
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?
Maybe return a page reporting the problem to the client? Pavlos
Me> valid circumstances under which this might occur? Does this just Me> represent a broken browser or communication-challenged connection? Me> Can I fake a content type and continue or is it a lost cause at this Me> point because something more tragic will likely happen further down Me> the line? Pavlos> Maybe return a page reporting the problem to the client? I believe ZopeHTTPServer is already doing that. If nothing else, users will see, "Sorry, an error occurred." I'm curious about what would cause a request to come in without a Content-type header, and what (if anything) I can do to work around the problem and let the user actually see the content they were seeking. 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
participants (2)
-
Pavlos Christoforou -
skip@mojam.com