[Zope] Sorting Not Sorting

tonylabarbara at aol.com tonylabarbara at aol.com
Fri Aug 3 12:28:10 EDT 2007

I have this code:

<table cellpadding="0" width="75%" border="0"
?????? tal:define="category python:getattr(request, 'category', '');
?????????????????? items python:here.EMarket.marketItems.getItemsInCategory(category);
?????????????????? sort_on python:(('name', 'cmp', 'desc'),);
?????????????????? items python:sequence.sort(items, sort_on);
?????????????????? start python:getattr(request, 'start', 0);
?????????????????? batch python:modules['ZTUtils'].Batch(items, size=6*here.EMarket.in_row, start=start);
?????????????????? previous python:batch.previous;
?????????????????? next python:batch.next">
? <tr>
??? <td align="center" class="text">
????? <a tal:condition="previous" tal:attributes="href string:${request/URL0}?category=${category}&start:int=${previous/first}">&lt;&lt;Previous</a>&nbsp;&nbsp;&nbsp;<a tal:condition="next" tal:attributes="href string:${request/URL0}?category=${category}&start:int=${next/first}">Next&gt;&gt;</a>
??? </td>
? </tr>
? <tr>
??? <td align="center">
????? <div tal:condition="batch" tal:omit-tag="">
??????? <div tal:condition="python:here.EMarket.in_row == 1" tal:omit-tag="">
????????? <span tal:repeat="item batch" tal:omit-tag="">
??????????? <span metal:use-macro="here/AddToCart_frame_content/macros/marketitem_one"/> 

It sorts the products by name correctly when I display the products (as you can see at http://lariman.com and click "Store" then "cabuchones"), but if you click on one of the products, it shows a different product than the one you clicked! Now, this code works fine without the "sort_on" part, so I suspect the problem is in the batching and the "item batch", which for some reason isn't sorting as I specify. Suggestions?

AOL now offers free email to everyone.  Find out more about what's free from AOL at AOL.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20070803/b289e905/attachment.htm

More information about the Zope mailing list