[Zope] dtml-with using string reference and acquisition
Matt
matt.bion@eudoramail.com
Sat, 28 Oct 2000 00:37:20 +1300
Hi, I am having a problem with using a string reference to an object.
The scenario is as follows :
I have the tree structure -
testfolA
display_method
testfolB
testfolC
if display_method looks like the following, everything is fine :
<dtml-var standard_html_header>
<dtml-call "REQUEST.set('go_here','testfolB')">
<dtml-with "_[go_here]">
<dtml-var id>
</dtml-with>
<dtml-var standard_html_footer>
it returns testfolB as I would expect.
now if I change <dtml-call "REQUEST.set('go_here','testfolB')"> to now
read <dtml-call "REQUEST.set('go_here','testfolB.testfolC')"> I get a
Key_error that the URL does not exist.
So I understand that testfolB.testfolC is not explicitly on the
namespace stack, where as testfolB is, so that calling <dtml-with
"testfolB.testfolC"> would work since it is a sequential object
traversal, but unfortunately I have to create the second level object
through a string reference that is passed in through a form. In some
instances it may be more than 2 levels deep. Is there a way to traverse
a string name of an object in one hit, or do I need to use String.split
and traverse through each object name doing a "_[.... or
"_.callitem(.... ?
Any help would be very much appreciated.
regards
Matt Bion