[mod_python] I need to create a Zip file on the fly and write it tothe stream without any temp files or in memory file creation?

Graham Dumpleton grahamd at dscpl.com.au
Mon Mar 6 19:58:33 EST 2006


Can you please explain the .tell() issue and how it is a problem? If
you are packing it into an instance of StringIO rather than onto req,
then it will be able to find a .tell() function and others it needs.
Obviously, the issue with StringIO is that it must hold it all in
memory until everything is complete and only then can you send
data. Ie., can't be streamed as you go.

Thus, please show examples of how you were using ZipFile and go
into more detail of why it doesn't work and what errors you get.

Graham

jarrod roberson wrote ..
> just to stop the responses now mod_deflate is NOT what I need. I need the
> end user to get a pop up that allows them to down load the contents of
> a
> directory as one big zip file.
> 
> I have a servlet in Java that does just this using the ZipOutputStream
> and
> it works great! You can download giant directorys with very very little
> load
> on the server since I am doing a ZERO level compression.
> 
> The reason I am looking at a mod_python solution is the way we have mod_dav
> set up right now it takes over the namespace that we need to do redirects
> from and can't get Apache to redirect the URL to the Java Servlet, and
> we
> have a big time crunch and can't re-archtiect the entire directory layout
> to
> try and fix it right now.
> 
> I saw a post recommending to use ZipFile, ZipFile won't work, it needs
> .tell(). It updates all the zip headers after the fact.
> I found something called zipstream.py, but alas, it does the same thing!
> 
> Before I go and write a ZipOutputStream wrapper around the request object,
> I
> wanted to see if any of you know of anythign out there that does this.
> 
> Thanks again, and remember mod_deflate is NOT going to work.


More information about the Mod_python mailing list