[Zope] General ZOPE Programming Question
R. David Murray
bitz@bitdance.com
Sun, 5 Mar 2000 13:47:59 -0500 (EST)
On Sun, 5 Mar 2000, Michael Lausch wrote:
> <dtml-in products>
> <dtml-var "URL1 + '/Products/' + _['sequence-item'] + '/New'">
> </dtml-in>
>
> but this doesn't work. Nothing is displayed. I also tries
> <dtml-var expr="...."> and <dtml-call "..."> (the last one
> was pure desperation).
I'm a relative beginner to Zope, so I'm not sure what I'm talking
about <grin>, but it seems to me from my limited experience that
you can't call out an object using a URL in a dtml-var. Instead
you need an object reference. So try something along these
lines (this is untested because I'm in the middle of my own
debugging mess):
<dtml-in products>
<dtml-var "Products.get_item(_['sequence-item'],0).New"
</dtml-in>
I'm sure the above is not right from a Zope standpoint, and
the Python is probably wrong too, but maybe it will send you in
in the right direction. What I'm aming for with that psuedo code
is to get the property of Products whose name is in sequence-item,
without rendering it (that's the ',0' bit), and to pick up
*its* 'New' property and render that. Maybe a real Zope expert
can correct my code.
Or more likely, as others have suggested, using a ZClass is the
right direction anyway, which would avoid the whole syntax issue
<grin>.
--RDM