[Zope] easy python script
Chris McDonough
chrism@digicool.com
Sun, 25 Mar 2001 21:44:06 -0500
def myreversesort(ob1, ob2):
return cmp(ob2.title, ob1.title)
l = context.folder.objectValues('DTML Document')
l.sort(myreversesort)
for x in l:
... do something ...
And people complain about DTML... ;-) It's so easy to do it, you forget how
hard it is otherwise.
----- Original Message -----
From: "Peter Bengtsson" <peter@grenna.net>
To: <zope@zope.org>
Sent: Sunday, March 25, 2001 8:04 PM
Subject: [Zope] easy python script
in DTML I do this...
<dtml-in "folder.objectValues('DTML Document')" sort=title reverse>
How do I do the same in a python script?
Here's a good start.
for thing in context.folder.objectValues('DTML Document'):
Strange, that this one's never crossed my mind, but never mind about that.
Peter
_______________________________________________
Zope maillist - Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope-dev )