[ZPT] extended path notation

Richard Jones richard@bizarsoftware.com.au
Sun, 8 Jul 2001 11:31:55 +1000


On Sat,  7 Jul 2001 06:04, ethan mindlace fremen wrote:
> I'm doing a fair amount of PT lately. In my main_template, I have
> probably 60 or so image references. Some of these are "stand alone"
> images, and some of them are in background tags. Some are also links.
>
> So I have to do this:
>
> <td background="dark_grey_bg.png" tal:attributes="background
> here/dark_grey_bg.png/absolute_url">
>
> and:
>
> <img src="button.png" tal:replace="structure
> python:('here/button.png').tag(border='0')">
>
> mostly, i think the fault lies with the image object, but I have two
> suggestions:
>
> 1. allow objects to suggest the attr's they'd like to provide.
>
> <img src="logo.png" border="0" tal:attributes="here/logo.png/attrs">
>
> would replace the src attr and add width and height attrs, but leave
> "border" alone.

The attrs variable in the TAL namespace would be able to achieve this, with 
the addition of the functionality you're asking for in #2 below. As a 
"long-time" PT developer, I'd like to second the request for arguments in 
path expressions. Most of our python expressions exist solely because we 
can't pass arguments to path expressions...


> 2. extend path notation to include variables:
>
> <img src="logo.png" tal:replace="structure here/logo.png?border=0">
>
> both could be handy, but the latter might be more used in non-image
> contexts.

So, I second this call :)


    Richard

-- 
Richard Jones
richard@bizarsoftware.com.au
Senior Software Developer, Bizar Software (www.bizarsoftware.com.au)