RE: [Zope] Subclassing Confusion
-----Original Message----- From: James W. Howe [mailto:jwh@allencreek.com]
What do I need to do to have the name "RenderableImage" in my base class list instead of two "Image" entries?
Your RenderableImage class inherits meta_type from Image, which is why there apear to be two Image classes. You have two of them because they both look identical to Zope, you have essentially taken a rich class and created another rich class with a little extra functionality. Both of these objects have the meta_type 'Image', for example, which is why you see two of them with the same name in the class list. They are different classes, but they have very similar meta-data associated with them. What you should do is create a very thin python class which you MIX-IN along with the rich Image class into a new ZClass with a new meta_type. So instead of: Image->YourClass You have: Image \ -> YourClass ThinBaseClass / Where 'ThinBaseClass' defines your new __str__ method and mixes this with the existing Image class into a new ZClass (with a new meta_type). Your thin base class can be very thin indeed: class ThinBaseClass: def __str__(self): ## whatever... pass -Michel -Michel
participants (1)
-
Michel Pelletier