Re: [Zope] dtml-with problem
On Sat, Nov 09, 2002 at 12:54:20PM -0700, Mark Gibson wrote:
Steffen Hausmann wrote:
I want to display some attributes of an object in a Form.
It works fine if I use
<dtml-with 20021109202414.0.0739256744506> <dtml-var title> </dtml-with>
but if I replace 20021109202414.0.0739256744506 (name of the object) by name (variable containing the name) im gettin a key error.
Sounds like you're referencing a string containing an object name, not the object.
You probably need to reference the object, not the name of the object. So try somthing like this:
<dtml-let myobjectname="'20021109202414.0.0739256744506'">
<dtml-with "_[myobjectname]"> <dtml-var title> </dtml-with>
</dtml-let>
I tried <dtml-with "_['myobjectname']"> before :( I didn't think about it properly... Thanks. Does someone know why <dtml-var expr="objectname.title"> dosn't work. MfG Steffen -- Manche Maenner bemuehen sich ein ganzes Leben lang, das Wesen einer Frau zu verstehen. Andere befassen sich mit weniger schwierigen Dingen, z.B. der Relativitaetstheorie.
Steffen Hausmann wrote:
On Sat, Nov 09, 2002 at 12:54:20PM -0700, Mark Gibson wrote:
Steffen Hausmann wrote:
I tried <dtml-with "_['myobjectname']"> before :( I didn't think about it properly...
Thanks.
Does someone know why
<dtml-var expr="objectname.title">
dosn't work.
Well, it depends what objectname is. If objectname='nameoftheobject', then objectname is just a string. So in effect the above statement says "give me the attribute 'title' of this string". A string doesn't have an attribute of 'title', so it fails. What you probably want to do is say something like <dtml-var expr="_[objectname].title">. "_[objectname]" says "search the namespace for an object with the name contained in the string variable objectname and give it to me". Mark
MfG Steffen
participants (2)
-
Mark Gibson -
Steffen Hausmann