[Zope] [helpme] shortening exploded path

Marcin Kasperski Marcin.Kasperski@acn.waw.pl
17 Apr 2002 23:17:30 +0200


Let me first describe the problem. As everybody knows, if my Zope site
looks so:

       [root]
         +-----[dirA]---[doc1]
         |
         +-----[dirB]---[doc2]

one can use URL like /dirA/dirA/dirB/dirB/dirB/doc2 to access the same
document as /dirB/doc2.

It is usually not the problem, but on my site I sometimes use such
links and for some reasons it would be hard to abandon it. And ... if
one starts Teleport or wget, he or she usually downloads huge
megabytes of replicas of the same file (things like dirA/doc1,
dirA/dirA/doc1, dirA/dirA/dirA/doc1, ... dirA/dirB/dirA/doc1, ...)

So, I would like to write some kind of SiteAccess rule, which would
check whether the client uses such a path - and if so, redirected 
to the correct one to prevent the explosion. I imagine its pseudologic
so:

   obj = the-destination-object
   if obj.url() == the-path-used-by-the-client 
       process-the-request
   else
       redirect the client to obj.url()

Could anyone help me writing exact code which would do such a thing?
Is it a good idea? Wouldn't it conflict with VirtualHostMonster (I use
zope behind apache)?


PS I know that one can write <a href="<dtml-var something url>">
instead of <a href="something">. Unfortunately there are places where
I can not do it (specific ZClass which does not inherit from
DTML*something and is heavily used).

-- 
( Marcin Kasperski   | Osoba jest omegalizacją ewolucji uniwersalnej na      )
( http://www.mk.w.pl | określonym odcinku etapowym (Teilhard de Chardin)     )
(----------------------------------------------------------------------------)
( Grupy dyskusyjne w firmie: http://www.mk.w.pl/narzedzia/narzedzia_inn      )