Re: [Zope] Getting an object from its name
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
Rafael Cordones Marcos wrote:
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')">
I think a simpler approach (possibly more solve-able) would be to DTHL let img = 'Figure1' and just use a normal method that relies on the img variable, no passing variables. I say this because your trying access the "img = 'Figure1'" from an unknown point in the zope namespace from your "showImage" method. (__don't take this as "the last word" unless some else backs my up!__) But from another email, I believe you lose all the normal stuff calling DTML methods like you are and not including the namespace and REQUEST... David, quickly-disconnects-thinking-he-forgot-to-engage-brai
showImage1: <img src="<dtml-var img>">
showImage2: <img src="<dtml-var img>"> <dtml-var "_[img].title">
participants (2)
-
David Kankiewicz -
Rafael Cordones Marcos