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
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 )
How about creating a body-dtml method in the root, with <dtml-with firstSlide> <dtml-var body> </dtml-with> --On Freitag, Januar 25, 2002 01:51:53 -0500 "Craeg K. Strong" <cstrong@arielpartners.com> wrote:
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 )
Mit freundlichen Grüßen Joachim Schmitz -------------------------------------------------------------------- AixtraWare Ingenieurbüro für Internetanwendungen Hüsgenstr. 33a, D-52457 Aldenhoven Telefon: +49-2464-8851, FAX: +49-2464-905163 -------------------------------------------------------------------- Key fingerprint = DA10 CC82 62F8 1DBB 39A1 1EDC 725B 3317 A8D7 C3A6 Keyserver: http://germany.keyserver.net/en/
On Fri, 25 Jan 2002, Joachim Schmitz wrote:
How about creating a body-dtml method in the root, with
<dtml-with firstSlide> <dtml-var body> </dtml-with>
Or have that body method to a RESPONSE.redirect, if having the page have the "wrong" URL confuses things. --RDM
participants (4)
-
Adrian Hungate -
Craeg K. Strong -
Joachim Schmitz -
R. David Murray