[mod_python] Looking for ClearSilver tips

jamestmcneill-python at yahoo.co.uk jamestmcneill-python at yahoo.co.uk
Sun Sep 4 06:12:23 EDT 2005


Good morning.

I believe that there's at least one person on this list using ClearSilver
templates with mod_python, and I'm trying to do that myself in the
interests of speed and simplicity. However I'm coming up against the
bounds of my ignorance, so I thought I'd ask for a couple of tips to help
get my wheels out of the mud. I'm also open to suggestions on using other
templating systems should they be more appropriate.

Firstly, do I need to use the CGI handler, or can I use the mod_python
handler (4 times faster says the documentation)? Secondly, what's the best
arguments to cgiWrap? Lastly, how do I tell ClearSilver where to pick up
its template files? I'd better explain where I've got to so far:

from mod_python import apache
import kinterbasdb as fdb
import neo_cgi

def handler(req):
    req.content_type = "text/html"
    cgi_environment = {'dummy': 0}
    neo_cgi.cgiWrap(req.read, req.write, cgi_environment)
    neo_cgi.update()
    ncgi = neo_cgi.CGI()
    . . . . .
    ncgi.display(r"C:\Program Files\Apache
Group\Apache2\htdocs\test\hello.cst")

This gives me the following traceback:

Traceback (most recent call last):

  File "C:\Python23\Lib\site-packages\mod_python\apache.py", line 299, in
HandlerDispatch
    result = object(req)

  File "C:/Program Files/Apache Group/Apache2/htdocs/test/\htpasswd.py",
line 54, in handler
    ncgi.display(r"C:\Program Files\Apache
Group\Apache2\htdocs\test\hello.cst")

Error: Traceback (innermost last):
  File "cgi.c", line 1466, in cgi_display()
  File "cgi.c", line 1371, in cgi_output()
  File "cgiwrap.c", line 203, in cgiwrap_write()
IOError: write_cb returned -1<105: [2] No such file or directory


OK, I've probably done at least 5 dumb things in there. Would anyone who
has been down this road be able to give me a couple of pointers?

Thanks,
Jim

++++++++++++++++++++++++++++++++++++++++++++++++++
+   If you've got a good excuse - don't use it   +
++++++++++++++++++++++++++++++++++++++++++++++++++)



More information about the Mod_python mailing list