[Zope] Operator overriding not working with Zope class.
Sean Hastings
whysean at softhome.net
Tue Oct 26 03:17:17 EDT 2004
It might be an order of inheritance issue. Try changing the order in which
you declare the parent classes:
class ZPerson(ZopeClasseses, ..., Person):
....
--Sean
> -----Original Message-----
> From: zope-bounces at zope.org [mailto:zope-bounces at zope.org]On Behalf Of
> Etienne Labuschagne
> Sent: Tuesday, October 26, 2004 3:05 AM
> To: zope at zope.org
> Subject: [Zope] Operator overriding not working with Zope class.
>
>
> 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
> _______________________________________________
> 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