Graham Dumpleton
grahamd at dscpl.com.au
Sun Apr 9 21:02:11 EDT 2006
Jay wrote .. > if s is None: > temp_doc = ''.join(temp_doc) > --> filter.write(main(temp_doc)) > filter.close() > > I'm quite inclined to believe that I've something misconfigured, or my > code is weak. I highly doubt that it's a mod_python problem per se. Change the main() function: def main(data): """ Get the latex source; return a raw string for the webserver to send to the client Take the outgoing HTML and turn it into a python object. Search the object for the <div> and <span> tags that indicate latex source -- the tags we can handle are given in the global variable TYPES. If there isn't anything to handle, return. If there is, process it and return a pretty-ied raw string of HTML for the webserver to send to the client. Notes: A working directory must be set via os.chdir so latex knows where to put its output """ if not os.path.isdir(TEMPDIR): os.mkdir(TEMPDIR, 0755) os.chdir(TEMPDIR) soup = BeautifulSoup(data) equations = soup.fetch(TYPES) if not equations: # return return data # <-------------------------------------- In other words, if there are no embedded equations, return the original page content as is. Graham
|