Hi I'm writing some somewhat convoluted ZPT that should work tho, <tr tal:repeat="row python:range(2)"> <td align="center" tal:repeat="plate python:plates[row * 2:(row * 2) + 2]"> FORMAT CONTENT </td> </tr> Zope is giving me an error complaining about a missing __getslice__ I was thinking about writing one but then I found out that __getslice__ is deprecated in newer versions of Python. What's the deal here?? TIA, Jordan Baker Contradix Corporation "Holistic IT Solutions"
Jordan Baker wrote:
Hi I'm writing some somewhat convoluted ZPT that should work tho,
<tr tal:repeat="row python:range(2)"> <td align="center" tal:repeat="plate python:plates[row * 2:(row * 2) + 2]"> FORMAT CONTENT </td> </tr>
Zope is giving me an error complaining about a missing __getslice__
If I create the following template based on your code it runs fine. It may be a problem with whatever your 'plates' object is in the second tal:repeat. <html> <head> <title tal:content="template/title">The title</title> </head> <body> <table> <div tal:define="plates string:slkfdjlskdjfldskjsdfsdfsdfsdff"> <tr tal:repeat="row python:range(2)"> <td align="center" tal:repeat="plate python:plates[row * 2:(row* 2) + 2]"> <div tal:replace="plate"></div> </td> </tr> </div> </table> </body> </html>
Ya I forgot to include the definition of plates which is an instance of ZTUtils.Batch Basically, it appears ZTUtils.Batch doesn't support slicing. I was able to come up with a workaround using a snazzy list comprehension but ultimately that is a hack and I'd much rather be able to use slicing. So is there a technical reason that Batch objects shouldn't allow slicing? Jordan Baker Contradix Corporation "Holistic IT Solutions" -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org] On Behalf Of Kevin Carlson Sent: Friday, June 06, 2003 6:07 PM To: jbb@contradix.com Cc: zope@zope.org Subject: Re: [Zope] slicing ZTUtils.Batch Jordan Baker wrote:
Hi I'm writing some somewhat convoluted ZPT that should work tho,
<tr tal:repeat="row python:range(2)"> <td align="center" tal:repeat="plate python:plates[row * 2:(row * 2) + 2]"> FORMAT CONTENT </td> </tr>
Zope is giving me an error complaining about a missing __getslice__
If I create the following template based on your code it runs fine. It may be a problem with whatever your 'plates' object is in the second tal:repeat. <html> <head> <title tal:content="template/title">The title</title> </head> <body> <table> <div tal:define="plates string:slkfdjlskdjfldskjsdfsdfsdfsdff"> <tr tal:repeat="row python:range(2)"> <td align="center" tal:repeat="plate python:plates[row * 2:(row* 2) + 2]"> <div tal:replace="plate"></div> </td> </tr> </div> </table> </body> </html> _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
Jordan Baker -
Kevin Carlson