[Zope] Modifying __bases__

Tino Wildenhain tino at wildenhain.de
Fri May 20 14:37:46 EDT 2005


Am Freitag, den 20.05.2005, 13:48 -0400 schrieb Dan Pozmanter:
> Well, when I run it, I am able to do the following:
> 
> ------------------------------------
> class A: 
> 	pass
> 
> class B(A):
> 	pass
> 
> b = B()
> 
> B.__bases__ = ()
> 
> print B.__bases__
> ------------------------------------
> 
> Not so on the version that comes with zope.
> (B.__bases__ will remain unchanged.)
> 
> What I aim to do is have the User Object inherit from a custom class
> (AlienUser).

Well, you can just inherit with a class from zopes extension classes.
You cannot modify the class bases like this with extension classes.

You can work around that like I did with the history (monkey) patch:

http://www.zope.org/Members/tino/PatchHistory/view

Otherwise it sounds evil and you failed to show the true
motivation with your example above.

Tino.

PS: Votes for a true implementation in current zope instead
    of the monkey patch? If so, tell me.





More information about the Zope mailing list