[Zope] get url for localfs objects

Paul Winkler pw_lists at slinkp.com
Thu Aug 14 11:20:12 EDT 2003


On Thu, Aug 14, 2003 at 03:10:16PM +0200, Michael Bleijerveld wrote:
> Hi,
> 
> I am using the following statements for displaying links to Localfs objects.
> 
> <tr tal:repeat="files batch" >
>       <td><input type="checkbox" name="ids:list" value="<dtml-var id>"></td>
>       <td><a href="HOME_URL" tal:attributes="href python:getLink(id)"
> tal:content="files/id">HOME TITLE OR ID</a></td>
>      <br>
> </tr>
> 
> 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

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's SPOT-WELDER X!
(random hero from isometric.spaceninja.com)



More information about the Zope mailing list