[Zope-dev] Implementing a URL path resolver

morten@esol.no morten@esol.no
Thu, 18 Jan 2001 11:26:10 GMT+1


Hi guys,

I've been tinkling with a function that does what REQUEST.resolve_url does,
except without it relying on having a REQUEST instance available.

That is, just resolving the path itself, something like this:

path ˙string.split(relative_url, '/')
path ˙filter(None, path)
new_path ˙'%s' % path[0]
path ˙path[1:]

for element in path:

	new_path ˙new_path + "['%s']" % element

return eval("self%s" % new_path)

Now, neither []- or .-like evaluation of the path works..

Any ideas?

Cheers,

Morten