[Zope] sorting ids in python
Andreas Jung
lists at zopyx.com
Thu Dec 11 07:44:41 EST 2008
On 11.12.2008 12:28 Uhr, Peter Bengtsson wrote:
> Personally I prefer to always use objectValues(). Sorting isn't
> objectXXX()'s problem. It's something you do in your view.
> objs = list(self.objectValues())
> objs.sort(lambda x,y: cmp(x.id, y.id))
Never ever use obj.id. The official API is obj.getId() - nothing
else.
Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lists.vcf
Type: text/x-vcard
Size: 316 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20081211/eb4d06c6/attachment.vcf
More information about the Zope
mailing list