Re: [Zope] Finding Newest Document
Dieter Maurer wrote:
article = Catalog(sort_on='dateofpublication')[0] Won't that give you the oldest document?
Yup :-) I meant: article = Catalog(sort_on='dateofpublication',sort_order='reverse')[0] *sheepish grinz* Chris
Or the even faster (since it doesnt have to reverse anything): article = Catalog(sort_on='dateofpublication')[-1] Cheers. -- Andy McKay. ----- Original Message ----- From: "Chris Withers" <chrisw@nipltd.com> To: "Dieter Maurer" <dieter@handshake.de> Cc: <zope@zope.org> Sent: Sunday, July 22, 2001 1:54 PM Subject: Re: [Zope] Finding Newest Document
Dieter Maurer wrote:
article = Catalog(sort_on='dateofpublication')[0] Won't that give you the oldest document?
Yup :-)
I meant: article = Catalog(sort_on='dateofpublication',sort_order='reverse')[0]
*sheepish grinz*
Chris
_______________________________________________ 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 )
Andy McKay wrote:
Or the even faster (since it doesnt have to reverse anything):
article = Catalog(sort_on='dateofpublication')[-1]
True... what I actually did was keep track of the latest dateofpublication in a property somewhere, and then do the following search when I want the latest bits: catalog = context.Catalog properties_get = context.Properties.getProperty return catalog.searchResults(dateofpublication=properties_get('dateofpublication')) cheers, Chris
participants (2)
-
Andy McKay -
Chris Withers