[mod_python] publisher on psp

Graham Dumpleton grahamd at dscpl.com.au
Wed May 17 00:19:51 EDT 2006


David Bear wrote ..
> I'm using the psp template formulation from the modpython web site.
> 
> I do not have any psp code in the template yet. The dispatcher code
> seems to be working. I have an html only file. I have an index.py
> file. In index.py I have a function called begin. The html template
> (which right now is only html) lives in documentroot/template. there
> is a graphic src image tag in that template that points to
> documentroot/images/my.jpg.  documentroot here means the directroy
> where index.py lives.
> 
> the problem is the image is never sent to the browser. I know it must
> be related to what document root is, and I assume the answer is found
> in some psp global variable...so, how do I construct my <img src="..">
> tag to properly find the jpg?

Calculating correct relative to URLs when using publisher is a PITA
because multiple URLs can refer to the same resource. See prior
commentary on this:

  http://www.modpython.org/pipermail/mod_python/2006-March/020501.html

The link includes code which may be of some use in at least
reliably calculating a relative URL to the directory the PythonHandler
directives was defined for. Knowing that, you can then extend
it to parent or sibling directories as appropriate using posixpath.join().

Graham


More information about the Mod_python mailing list