[Zope] Including Script-Generated String in Method Call
Dan Shafer
dan@gui.com
Sat, 29 Dec 2001 22:03:13 -0800
I have been chasing my tail on this one for the better part of two
hours now. Time to ask for help.
My goal:
I want to load a page whose URL looks like "day1.html" where the
number in the name of the page changes.
I have written a Python script called pagetoget which calculates the
day number correctly and assembles the URL as a string, which it
returns. This seems to work.
In the page where I want to include this page, I essentially had only
three lines:
<dtml-var standard_html_header>
<dtml-var pagetoget>
<dtml-var standard_html_footer>
That produces a page which contains the string of the URL, naturally.
Not what I had in mind, but that's clearly what it should do.
So the question I spent the better part of the evening on is how I
get the string generated by the Python script to be callable from a
DTML Document so that the page named by the string value gets
displayed.
I've tried everything I can think of. I finally decided I had to do a
redirect, so I coded this:
<dtml-call "RESPONSE.redirect(<dtml-call pagetoload>)">
On this, I get an invalid syntax error. I've tried mucking with the
quotation marks (which are annoying as heck, as I'm sure everyone
already knows) but nothing I tried worked. I just cannot get that
syntax right.
I've also tried using dtml-var instead of dtml-call in both places; no joy.
Am I on the right track? Is there a better way to do this? This has
to be something that hundreds of you experienced Zope dudes have done
hundreds of times, but the documentation is either missing or
difficult to find with search mechanisms.
I'm going to keep at it but I'm getting pretty discouraged. Seems
like this should be so easy....
--
Dan Shafer, Author-Consultant
http://www.danshafer.com
http://www.shafermedia.com