[ZPT] Can't get getSize to work

Sean something at gmail.com
Wed Sep 1 07:46:50 EDT 2004


I can't get examples from
http://zope.org/Documentation/Books/ZopeBook/2_6Edition/ZPT.stx
to work. 
Specifically I've been trying this code:

<table tal:condition="container/objectValues"
border="1" width="100%">
<tr>
<th>Number</th>
<th>Id</th>
<th>Meta−Type</th>
<th>Title</th>
</tr>
<tr tal:repeat="item container/objectValues">
<td tal:content="repeat/item/number">#</td>
<td tal:content="item/getSize">Id</td>
<td tal:content="item/meta_type">Meta−Type</td>
<td tal:content="item/title">Title</td>
</tr>
</table>

I get this error:
Error Type
    KeyError
Error Value
    'getSize'

Also the Python script example (filesize macro) don't work 'cause they
use the same function getSize.
The same template works fine in a Folder where there are only files
(no subfolders) so I think maybe Folder objects have no size so
getSize fails and causes error?
I've been trying to modify the code to list only non-Folders (files,
actually) but I don't know how to do it - this is what I tried
(doesn't work of course)
<tr tal:repeat="item container/objectValues([!='Folder'])" tal:omit-tag="">

Can someone help me with this?

Thanks
Sean


More information about the ZPT mailing list