[Zope] python question

Jim Abramson jabramson at wgen.net
Tue May 31 15:38:17 EDT 2005


sort() on a sequence does not return anything.  It operates on the
[mutable] sequence in place.

You probably want to push this bit into a python script where you have
more elbow room, and do this:

files.sort(etc,etc)
return files[0]

hth,
Jim
 

> -----Original Message-----
> From: zope-bounces at zope.org [mailto:zope-bounces at zope.org] On 
> Behalf Of Kate Legere
> Sent: Tuesday, May 31, 2005 3:35 PM
> To: Zope
> Subject: [Zope] python question
> 
> I may be asking this in the wrong place but I have a tal page 
> where I want to use python to display only the most recent 
> addition to a folder of files.
> 
> 
> I can sort the folder and return all the files easily with:
>  return sequence.sort(files, (('bobobase_modification_time', 'cmp',
> 'desc'),))
> 
> How do I return just the most recent one? (I tried sorting 
> and then using return max(files) but that doesn't give me all 
> the properties and I need them for display) 
> 
> Kate
> 
> _______________________________________________
> Zope maillist  -  Zope at 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 )
> 


More information about the Zope mailing list