Hi, I want to get a list of 10 most updated objects contained in my Product. I can use self.objectValues('Something'), but I don't know how to sort it by "id/cmp/desc" from within Python. So I need Python equivalent of this DTML code: <dtml-in prefix="loop" expr="objectValues('Something')" sort="id/cmp/desc" size="10"> Is there something in Zope to do this, or do I have to write sorting method and sort it myself ? regards, Michal
On Thu, Jun 20, 2002 at 05:16:31PM +0200, Michal Bencur wrote:
<dtml-in prefix="loop" expr="objectValues('Something')" sort="id/cmp/desc" size="10">
Is there something in Zope to do this, or do I have to write sorting method and sort it myself ?
Extended DTML Sort at your service! :) Something like this: from DTML import sequence return sequence.sort(objectValues('Something'), sort=(("id", "cmp", "desc"),)) Oleg. -- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
participants (2)
-
Michal Bencur -
Oleg Broytmann