[Zope] efficient internal redirect

Andy Heath a.k.heath@open.ac.uk
Mon, 13 Mar 2000 10:49:55 +0000


> Why can't they be the one and the same? Redirector is fast -- I suspect
> the difference in speed between Redirector and something else would be
> negigible.

I confess, what you have is a very good idea.  The reason I'm hesitating
is because there won't be two or three areas and its wrong to call
them areas.  They will be single documents and a little bit further down
the
road there may be hundreds of them needed and not in any homogenous
flat structure but at different places in a tree.  Also,
I really do need every last inch of speed out of this part.

Hardwiring your code to use a dictionary looks like a good idea for
the present.

Some questions:

1. does your product redirect back to the client or within zope?

2. assuming it were hardwired as you suggest what would be the runtime
cost over just having folder methods in zope do the redirection?

3. I haven't touched python for 2 years now (though I did use it a lot
then) - I'm very rusty.  Could you supply a patch to hardwire in a
dictionary
instead of the regex code?  Assuming 2. is satis this *could* be a good
answer.

4. still looking for an answer to my orginal q - what's the most
efficient way?


Andy

> 
> Remember that a Redirector folder is in itself just an index (of
> regexps -- it's not hard to wire the lookup so that, if the term is not
> a regexp, then it will use a dictionary, which is a lot faster). It does
> not need to contain anything, and you need only one Redirector folder to
> accomplish what you ask for. Let's say you have three areas that others
> link to: Downloads, Registration, and News. First, create a Redirector
> folder called, say, /Targets. Then edit the folder's redirection
> mappings to look like so:
> 
>         From                   To
>         Downloads              /Downloads
>         Registration           /Snark
>       News                   /News
> 
> Notice that the Registration name maps to /Snark -- this to illustrate
> the mappings have nothing to do with the *names*. Now, having done this,
> you can access your mappings like so:
> 
>         http://www.myserver.com/Targets/Downloads
> 
> which will redirect to
> 
>         http://www.myserver.com/Downloads
> 
> Isn't this what you want?
> 
> Alexander Staubo
> mailto:alex@mop.no
> http://www.mop.no/~alex/

-- 
-------------------------------------------------
Andy Heath                    a.k.heath@open.ac.uk
The Open University           +44 (0) 114 2885738