[Zope] Operator overriding not working with Zope class.

Etienne Labuschagne etiennelabuschagne at fusemail.com
Tue Oct 26 03:04:41 EDT 2004


I have two classes:

class Person:
     ....

class ZPerson(Person, ZopeClasses....):
     ....

in Person 'n override __gt__, __lt__, and some others.

 >>> p1 = Person()
 >>> p2 = Person()
 >>> p1.age = 20
 >>> p2.age = 30
 >>> p2 > p1
True

this doesn't work for the derived Zope class:
 >>> p1 = ZPerson() #ok, I create this in the "proper" zope way and
                    #later retrieve it, but you get the idea
 >>> p2 = ZPerson()
 >>> p1.age = 20
 >>> p2.age = 30
 >>> p2 > p1
False
 >>> p2.__gt__(p1)
True

For some reason my __gt__ is not used when using the > operator.  If 
called explicitly, it works properly.

Any ideas?

Etienne


More information about the Zope mailing list