Ethan Toan Ton
ethanton at ethanton.com
Mon Sep 4 14:15:08 EDT 2006
Hi, I'm not sure if this is the correct forum to be asking for help with Mod-Python, but I figure I'd give it a shot. I was wondering if anyone had experience using a Mod-Python request handler to answer a javascript xmlhttprequest(). When my javascript program does a request on the xml file directly, all of the javascript parsing of the xml works fine. However, when I try to call the request handler and get it to read the file in and return the request, the javascript can't parse the xml. Here's the code: LOCAL_FILE = 'htdocs/ethan/info.xml'; def get_request(req): if req.method == 'GET': file = open(LOCAL_FILE, 'r') req.content_type = "application/xml" req.write(file.read()) return apache.OK The same data is sent, but I'm not sure if there is a formatting problem here. I'm assuming that's the problem, but I'm at a loss as to the solution. req.sendfile(LOCAL_FILE) does not work either. Any help would be greatly appreciated. Ethan
|