I have a similar situation where I find myself way down in the tree
structure and have to go up to a certain point and down again. Leaving "bad
structuring" aside (actually its well structured in many other respects),
all I could think of to get a hold of these objects was a whole bunch of
nested "with" statements. They suck.

Now what's with your PathHandler product? How would an appropriate method
look like? I was thinking of a "walk2object" method rather than
"showImage"... see I don't want to start at "/", I want to start whereever I
like at that moment and still take the "/"-separated path info to "walk" to
my object.

I think this has more to do with elegance than with lazyness. (tho these two
know each other very well ;-) )

tia,
Danny


Dieter Maurer wrote:
>
> Then Chris Withers wrote: use
>
>     <dtml-with images><dtml-var image.gif></dtml-with>
>
> I did not believe him and tried it out...
> ... it works in Zope 2.2.2.

...worked for me all the way back to 2.1.4 ;-)

Anyway, if you're _really_ lazy, write an external method something
alogn the lines of:

def showImage(self,path):
        return self.restrictedTraverse(path)(self,self.REQUEST)


...then, in your dtml, you can do:

<dtml-var "showImage('/images/image.gif')">

This is all totally untested of course ;-)

I've often wondered why this isn't built into DTML so that you could do:

<dtml-var /folder/myobject>

obviously, you wouldn't be able to do this with stuf inside " " ;-)

cheers,

Chris

_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )



_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to