View Single Post
  #1  
Old 11-21-2008, 03:58 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
IE cannot display form response page from python server

I’m using a local python web server to receive data from a form displayed with HTMLViewer. Internet Exploder/HTMLViewer gives a “Cannot display page” error when the python web server attempts to write back a ‘Post OK’ message. When I just run the web server and submit the form with Firefox, it displays the message.

What does the web sever need to do for IE to display a form response page?

Here is the python code that handles the form POST request and writes back the response:
Code:
class MyHandler(CGIHTTPRequestHandler):

	def do_POST(self):
		global rootnode
		self.send_response(301)
		
		self.send_header('Content-type',	'text/html')
		self.end_headers()
		
		rawForm = self.rfile.read(int(self.headers['Content-Length']))
		parseDic = cgi.parse_qs(rawForm)
		
		stringy = r'<html><head></head><body>POST OK.</body></html>'
		self.wfile.write(stringy)
		
		e = viz.Event()
		e.resultsDic = parseDic
		viz.sendEvent(RECEVED_TEST_DATA_EVENT, e)

I have attached a zip with test files. Run QuestionAsker.py to reproduce issue.
Attached Files
File Type: zip htmlviewertest.zip (52.2 KB, 1582 views)
__________________
Paul Elliott
WorldViz LLC
Reply With Quote