Jeremy Evans
jkevans at pacbell.net
Wed Mar 17 22:14:14 EST 2004
Gregory Bond wrote: > cfox at cfconsulting.ca said: > >>How can I get it to run in stand-alone mode? > > > Short answer: you can't. > > See FAQ 2.2: http://www.modpython.org/FAQ/faqw.py?req=show&file=faq02.002.htp This is a little off topic, but that FAQ Entry isn't completely accurate. At the very least, you can import the _psp module. For example, the following code will work as a command line psp->html converter: #!/path/to/python from mod_python._psp import parse import os class psp2html: def __init__(self, f): self.fil= file(f,'w') def write(self, data, blah=""): self.fil.write(data) os.chdir('/path/to/page/') req = psp2html('index.html') exec(parse('index.psp')) I release it is probably considered bad form to import the "private" _psp module, but importing psp doesn't work, because psp imports apache which imports _apache. However, as long as you aren't using any other mod_python modules in the psp code for the page you are converting to html, the above should work (it does for me, at least). The class is needed because the psp parser uses the req.write() function with both 2 and 3 arguments in different places, so making req a file won't work. > > > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://mailman.modpython.org/mailman/listinfo/mod_python >
|