[Zope-dev] How to automatically redirect publishing request to another folder?
Adrian Hungate
adrian@haqa.co.uk
Fri, 25 Jan 2002 07:55:53 -0000
Try using a site access rule, it's almost as powerfull as the traversal
roulette, but it happens after zope has finished traversing. You could write
a Python Script, something like:
=================
import string
if string.split(context.REQUEST['PATH_INFO'], '/')[-1] ==
'my_parent_folder':
context.REQUEST.RESPONSE.redirect('my_first_slide')
=================
CAUTION: Remember how to turn off site access rules (Adding
_SUPPRESS_ACCESSRULE to the begining of the path) incase it all goes wrong
:)
Adrian...
--
The difficulty of tactical maneuvering consists in turning the devious into
the direct, and misfortune into gain.
- Sun Tzu
----- Original Message -----
From: "Craeg K. Strong" <cstrong@arielpartners.com>
To: <zope-dev@zope.org>
Sent: Friday, January 25, 2002 6:51 AM
Subject: [Zope-dev] How to automatically redirect publishing request to
another folder?
> Hello:
>
> We have a Slideshow product that is similar to OrderedFolder in that it
> maintains an ordered
> list of contents. Each subfolder represents a slide. To view a
> particular slide, you navigate to the
> subfolder, it automatically calls "index_html," and there's your slide.
>
> All of the slides actually acquire their index_html DTMLDocument from
> high up on the food chain. The index_html in turn calls <dtml-var
> body> and the body is, of
> course, different for each slide. This is convenient, b/c each slide
> shares header/footer/etc.
>
> My problem is this. When you type in the URL of the top level folder
> (that is, the slideshow folder itself)
> I want Zope to behave as if you typed in the URL of the first slide
> automagically. The Slideshow product
> has an easy way to get our mitts on the firstSlide object, so that part
> is not a problem, but I cannot get it to work.
>
> Of course, if I create an index_html() method directly in my
> Slideshow.py, that screws up my acquisition.
> Zope dies with an infinite recursion.
>
> Next try: using __bobo_traverse__() That is a little bit nasty, b/c
> you have to figure out whether you are
> the "end destination" or if Zope is just "passin' thru."
> [ See http://www.zope.org//Members/andym/wiki/MessingWithTraversal ]
>
> Nothing works quite right. Conceptually I know what I want to do:
> call index_html on firstSlide()
> in the _context_ of firstSlide(). However, my Zope Zen is failing me.
> Has anyone done something like this?
>
> Thanks in advance!
>
> --Craeg
>
>
> _______________________________________________
> Zope-Dev maillist - Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope )
>