[Zope] Getting an object from its name

Rafael Cordones Marcos rcm@bcnartdirecte.com
Sat, 23 Oct 1999 22:05:25 +0200


Hi,

Thanks for your answers. I couldn't get it to work though.
By the way, where does this indirection thing comes from?
I had not seen it in any of the docs I've read!

So my setting is:

showImage1 (DTML Method)
showImage2 (DTML Method)
Folder/
     Figure1 (DTML Doc)
     showImageDoc1
     showImageDoc2

showImageDoc1:
     <dtml-var "showImage1(img = 'Figure1')">

showImageDoc2:
     <dtml-var "showImage2(img = 'Figure1')">

showImage1:
     <img src="<dtml-var img>">

showImage2:
     <img src="<dtml-var img>">
     <dtml-var "_[img].title">

When accessing http://localhost:8080/Folder/showImageDoc1 I get:

     <img src="Figure1">

which is OK.

BUT when accessing http://localhost:8080/Folder/showImageDoc2 I get:

     Error Type: KeyError
     Error Value: Figure1

So I tried to up the DTML Method showImage2 into Folder like this:

showImage1 (DTML Method)
Folder/
     Figure1 (DTML Doc)
     showImageDoc1
     showImageDoc2
     showImage2 (DTML Method)

BUT when accessing http://localhost:8080/Folder/showImageDoc2 I get:

     Error Type: KeyError
     Error Value: Figure1

Any ideas?

NOTE: I've also tried:

<dtml-with "_[img]"><dtml-var title></dtml-with>

and

<dtml-with "_[_.str(img)]"><dtml-var title></dtml-with>

For both of them I get the same error!

Thanks for your time!

Rafa

-- 
Linux. The Choice of a GNU Generation! -> http://www.debian.org