[mod_python] [SPAM] URL returned by test.py

Bart scarfboy at gmail.com
Sat Nov 10 11:51:05 EST 2007


It's because of the somewhat strange way URLs work in the
python-publisher. In it, you always get the filename of the handler in
the URL, which to any client and their path calculations looks like an
extra directory.
Basically, every relative URL (like your href) will have to have an extra '../'

(You could use absolute URLs (within the (v)host), but if you ever
want to move things to another directory, you'ld have to go through
all your code to change the URLs.)

--Bart


On Nov 10, 2007 3:25 AM, Peter Hollenbeck <pwhbeck at gmail.com> wrote:
> Apache root is /srv/www/htdocs
>
> I open http://localhost/test.html
> Test.html calls test.py
> Test.py returns an html page with a link to an image in
> /srv/www/htdocs/pics/1998/...
> But the link displayed in the browser is
>     http://localhost/test/test.py/pics/1998/...
> not
>     http://localhost/pics/1998/...
>
> Can anyone tell me why this is?
> What can I do to get the link without "/test/test.py"
>
> Thanks very much,
> Peter Hollenbeck
>
>
> SUSE 10.2 Linux
> Apache 2.2.4
> mod_python 3.3.1 (I think)
>
> /srv/www/htdocs/test.html:
>       <html>
>       <p>
>       mod_python test
>       <p>
>       <form action="test/test.py/test" method="POST">
>           <input type="submit">
>       </form>
>       </html>
>
> /srv/www/htdocs/test/test.py
> def test():
>     link = '<a href="pics/1998/9804/bcsi/98042118.jpg"><img
> src="pics/1998/9804/bcsi/98042118tn.jpg">Logging road</a>'
>
>     htmlpage = '<html><body>'+link+'</body></html>'
>     rc = """$"""
>     rc = rc.replace('$', htmlpage)
>     return rc
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list