[mod_python] link to image files broken

piet at cs.uu.nl piet at cs.uu.nl
Fri Jul 6 11:30:42 EST 2001

>>>>> "Vincent Wong" <vincentwong at ionetbiz.com> (VW) writes:

VW> these are the test.py and thanks.html
VW> ---test.py---

VW> import os, sys
VW> def saveform(req):
VW>   input = open('../../thanks.html', 'r')

VW>   return input.read()

VW> ---thanks.html---
VW> marginwidth="0" marginheight="0" background="main/002darkgreen.gif"
VW> onLoad="MM_preloadImages('main/016community1.gif','main/017security1.gif','m

It is difficult to know without the context, but I guess the problem is
that your images are supposed to come from the directory `main', which I
suppose is relative to the directory where thanks.html is found. But the
browser doesn't know that the HTML file comes from ../.., it works relative
to the directory where your python script is located (or the original
script that calls this one).

So you could:
1. Change the image locations in thanks.html to ../../main
2. Move the main directory to the sirectory where your python scripts are
   (but this doesn't help if you also need to refer to thanks.html
3. Put a <BASE HREF="actual location of the thanks.html file"> in
   thanks.html or in the copy that you write.
I think 3 is the best solution.
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl

More information about the Mod_python mailing list