[ZPT] Using variables in path expressions

Peter Bengtsson mail@peterbe.com
Tue, 5 Jun 2001 12:42:10 +0200


Noted.
http://www.zope.org/Members/peterbe/DTML2ZPT/#example10
right?
----- Original Message ----- 
From: "Evan Simpson" <evan@digicool.com>
To: <zpt@zope.org>; "Brent M Hendricks" <brent@valinor.waldenweb.com>
Sent: Saturday, June 02, 2001 10:06 PM
Subject: Re: [ZPT] Using variables in path expressions


> From: "Brent M Hendricks" <brent@valinor.waldenweb.com>
> > Is there a way to get variable substitutions in path expressions the
> > way we have them in string expressions?
> 
> > <div tal:repeat="item here/queryIds">
> >   <span tal:content="here/subfolder/${item/id}/method" />
> > </div>
> 
> There is undocumented support for this.  We were holding off on making
> it part of the spec, waiting to see whether it's really needed.
> Technically, it's not, since you can write:
> 
> tal:content="python:path('here/subfolder/%s/method' % item.id)"
> 
> I admit that this is a little messy.  The undocumented capability does
> not allow paths (like 'item/id'), only raw variable names.  The name
> must contain either a string or a sequence of strings, which will be
> interpolated as one or more entire path segments:
> 
> tal:define="item_id item/id"
> tal:content="here/subfolder/?item_id/method"
> 
> Cheers,
> 
> Evan @ digicool
> 
> 
> _______________________________________________
> ZPT mailing list
> ZPT@zope.org
> http://lists.zope.org/mailman/listinfo/zpt