Re: [Zope] <dtml-with> Question
-----Original Message----- From: Sascha Matzke <matzke@metabox.de> To: zope@zope.org <zope@zope.org> Date: Sunday, October 10, 1999 2:03 PM Subject: [Zope] <dtml-with> Question
I want to do something like
<dtml-with "objA.objB.objC"> something </dtml-with>
but the "objA..."-part is in a string variable.
<dtml-with "stringvar"> or <dtml-with stringvar> don't work...
It sounds like you're basically trying to do a namespace lookup. <dtml-with "_[objA]"> should do what you want. Kevin
Hallo, On Sun, Oct 10, 1999 at 02:16:12PM -0400, Kevin Dangoor wrote:
It sounds like you're basically trying to do a namespace lookup.
<dtml-with "_[objA]"> should do what you want.
It doesn't... I have an variable named item with the value "Desk.Test.index_html". When I do <dtml-with "Desk.Test.index_html"> something </dtml-with> everything works fine. But when I try <dtml-with "_[item]"> something </dtml-with> I get Error Type: KeyError Error Value: Desk.Test.index_html Sascha -- .-> Sascha Matzke - sascha@bespin.de - http://www.bespin.de -. | Macht kaputt was euch kaputt macht... | | Ton Steine Scherben | `-- On this earth for 23 years, 362 days <----------------'
Sascha Matzke wrote:
Hallo,
On Sun, Oct 10, 1999 at 02:16:12PM -0400, Kevin Dangoor wrote:
It sounds like you're basically trying to do a namespace lookup.
<dtml-with "_[objA]"> should do what you want.
It doesn't...
I have an variable named item with the value "Desk.Test.index_html".
Storing a string representation to an object is generally not as useful as just storing a reference to it. Your using a variable anyway, and I can't think of any time where I've ever needed a string representaion of an objects 'relative' path in Python (which doesn't really exist as a concept, someone can prove me wrong). This is why you are running into dificulty, you are try to dereference a 'string', for which no such standard facility exists. Why don't you just make objA the actual object? <dtml-with objA> Voila </dtml-with> -Michel
Hello, On Sun, Oct 10, 1999 at 05:30:18PM -0400, Michel Pelletier wrote:
I have an variable named item with the value "Desk.Test.index_html".
Storing a string representation to an object is generally not as useful as just storing a reference to it.
I tried this. Let me describe the situation. I have two ZClasses ImageItem and Article. An Article can use one ore more ImageItems. As ImageItems can be reused by various Articles, they are stored in a central place. Now I want to know if an ImageItem is used by an Article. I want Articles to register themselves at the ImageItems they use. My first simple thought was to store the path of the Article and then reference it by <dtml-with> (which doesn't work as I expected). Sascha -- .-> Sascha Matzke - sascha@bespin.de - http://www.bespin.de -. | Eure Moral, Eure MGs werden nicht ewig regier'n... | | Anarchist Academy | `-- On this earth for 23 years, 362 days <----------------'
Sascha Matzke wrote:
My first simple thought was to store the path of the Article and then reference it by <dtml-with> (which doesn't work as I expected).
Ok, probably something better would be to store /an/absolute/path to the other object and use : <dtml-with "REQUEST.resolve_url(SCRIPT_NAME + '/an/absolute/path')"> blah. </dtml-with> Although I think someone developed a 'symlink' like product at one time.... ugh I can't keep all of Zope in my head! ;) -Michel
Hallo, On Mon, Oct 11, 1999 at 10:38:24AM -0400, Michel Pelletier wrote:
Ok, probably something better would be to store /an/absolute/path to the other object and use :
<dtml-with "REQUEST.resolve_url(SCRIPT_NAME + '/an/absolute/path')"> blah. </dtml-with>
Although I think someone developed a 'symlink' like product at one time.... ugh I can't keep all of Zope in my head! ;)
I got it working with object-references, but the reference seems not to be a reference in the sense of retaining the acquisition context... Sascha -- .-> Sascha Matzke - sascha@bespin.de - http://www.bespin.de -. | We want the world and we want it now... | | Jim Morrison | `-- On this earth for 23 years, 363 days <----------------'
participants (3)
-
Kevin Dangoor -
Michel Pelletier -
Sascha Matzke