[Zope] Subclassing Confusion
Jeff K. Hoffman
jeff@goingv.com
Wed, 19 Jan 2000 14:13:31 -0500 (EST)
On Wed, 19 Jan 2000, James W. Howe wrote:
> import Acquisition
> from OFS import Image
>
> class RenderableImage:
> def __str__ (self):
> Request = self.REQUEST
> if Request:
> try:
> Method = getattr (self, 'render')
> except AttributeError:
> return Image.__str__(self)
> return Method (self, Request)
> else:
> return "Renderable error: no request"
>
> My question is why didn't they show up? I would have thought that
> absent any other changes to my Image subclass, that the default Image
> views would show up as the views of my new ZClass.
If your ZClass is subclassing RenderableImage directly, then I think this
is your problem:
class RenderableImage:
should be:
class RenderableImage(Image):
The way things stand, your RenderableImage class is not a subclass of
Image. Changing the line to read as above fixes that, and will (hopefully)
fix the associated problem you describe.
> Thanks.
Hope this helps.
> James W. Howe
--Jeff
---
Jeff K. Hoffman 704.849.0731 x108
Chief Technology Officer mailto:jeff@goingv.com
Going Virtual, L.L.C. http://www.goingv.com/