Khurram
khurram at renai-soft.com
Tue Feb 3 17:55:29 EST 2004
An example of output compression. import gzip def getWriter(req): try: if req.headers_in['Accept-Encoding']=='gzip, deflate': return gzip.GZipFile('','wb',9,req) except: pass return req def processRequest(req): writer = getWriter(req) writer.write(header) writer.write(content) writer.write(footer) writer.close() # Good practice to do this. It does not try to close req object return apache.OK If you want to use it with Cheetah or another templating engine, most of them accept writers and you will be better off passing the writer to them for quick response. Khurram Ijaz, Renaissance Software. http://www.renai-soft.com ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.
|