[Zope] HTTP_REFERER

Anthony Pfrunder s341625@student.uq.edu.au
Fri, 30 Jul 1999 21:20:07 +1000 (GMT+1000)


On Fri, 30 Jul 1999, Katrin wrote:

> i use the HTTP_REFERER to get the path of the last page (something like:
> http://www.something.de/Ordner/page) but i need a way to get only the
> path like http://www.something.de/Ordner/.
> is there a way to do that?

An easy way is to use Python's os.path sevices (assuming you just want to
slice off the last path element).  Untested...

import os.path
path = os.path.dirname("http://www.something.de/Ordner/page"[6:])

The [6:] uses Python string spliting to chop off the http:/ bit which may
cause problems.

Cheers,

Anthony Pfrunder
Zope Community Development Partner