At 12:16 PM 3/15/99 -0000, julian@zereau.net wrote:
On 15-Mar-99 Jeff K. Hoffman wrote:
I think you need <!--#var img.name-->.
okay next qustion: I have a image under a folder called "images". <!--#var "images.somefilename"--> should work - except that the image filename contains the "." character (eg: "foo.gif") and this gets confused with the dot notation of the object (it tries to find images/foo/gif and chokes with a traceback)
In general, when you have trouble spelling an object's name in a variable expression because its name is not a legal Python name (e.g. 'sequence-item' or 'foo.gif') then you should use _[] or _.getitem However in your case you can simply get the sub-object with a plain old getattr: <!--#var "_.getattr(images,'foo.gif')"--> Another possibility is to use the with tag: <!--#with images--> <!--#var foo.gif--> <!--#/with--> Since these are so ugly, you might consider the simpler manual method of generating the img tag: <img src="images/foo.gif"> or else you might consider *not* having a images directory, and keeping your images in the Folders where they're used. Then you can refer to the images directly: <!--#var foo.gif--> And because of acquisition, foo.gif is accessible to all sub-Folders of the Folder it is located in, in the same way. -Amos