[Zope] Python script sort by id

Tim Hicks tim@sitefusion.co.uk
Sun, 29 Jul 2001 19:47:14 +0100


----- Original Message -----
From: "Maarten Slaets" <maarten.slaets@neolabs.be>
To: "Tim Hicks" <tim@sitefusion.co.uk>
Cc: <zope@zope.org>
Sent: Sunday, July 29, 2001 7:29 PM
Subject: Re: [Zope] Python script sort by id


> Tim Hicks wrote:
> > def sort_id(ob1, ob2):
> >    return cmp(ob1.getID(), ob2.getID())
> >
> > It seems that the cmp function needs to get hold of attributes, not
methods.
> > Even if I specifically call a method on ob1 or ob2, getattr seems to be
> > called in there somewhere.
> >
> > Any more clues?
>
> try getId() instead of getID()

Maarten,

that's cracked it :-)).

Thanks very much indeed.

tim