[mod_python] Looking for cookbook/recipe generating multipart web data

Raaijmakers, Vincent (GE Infrastructure) Vincent.Raaijmakers at ge.com
Mon Apr 5 09:09:28 EST 2004


My web server (apache+mod_python) needs to reply on some session with a multipart connection. 
My idea is to use the content-type of multipart/mixed; boundary=--myboundary

The data that I would like to send is a continuous stream of data, divided by that boundary.
Well, there are tons of examples on the web how to encode such a stream on the client side, but I can't find an example how to generate this data using mod_python.

So for now in the very simple example, my code looks like:

req.content_type("multipart/mixed; boundary=--myboundary")
while forever:
	data = "--myboudary\r\n%s" % getData()
	req.write(data)

However, for every req.write,  len(data) + lfcr + boundary/data + lfcr is send out and I just want to send boudary/data like I see in existing applications on the web and described in the w3 norms of multipart.

What is the correct way of doing this? Where can I find the proper cookbook?

Thanks, 
Vincent



More information about the Mod_python mailing list