[Zope] Re: get url for localfs objects

Philipp von Weitershausen philipp at weitershausen.de
Thu Aug 14 10:32:16 EDT 2003


Paul Winkler wrote:
>>However when I use the python script getLink I receive the following error.
>>What's wrong ?
> 
> 
> Several things. First, you're mixing tal and DTML. Second, you're not
> providing a namespace for getLink.
> Assuming that getLink is a python script that lives somewhere above this
> template, try this:
> 
>  <tr tal:repeat="file batch" >
>        <td><input type="checkbox" name="ids:list" value="id"
>               tal:attributes="value file/id"></td>
>        <td><a href="HOME_URL" 
>               tal:attributes="href python:container.getLink(file.id)"
>               tal:content="file/id">HOME TITLE OR ID</a></td>
>       <br>
>  </tr>
> 
> Note several changes:
> - I changed "files" to "file" because it's only one at a time.
> - Everywhere you use id, it must be file/id (in python, file.id).
> - value="<dtml-var id>" won't work in TAL ;-)
> - getLink lives somewhere... I'm betting on container.getLink

Note that you should never ever use object.id or object/id. Always use 
the getId() method (in TALES object/getId).

Phil





More information about the Zope mailing list