[Zope3-Users] Calling method of superclass

dev at projekt01.ch dev at projekt01.ch
Wed May 17 13:28:07 EDT 2006


Hi Florain
 

> -----Original Message-----
> From: zope3-users-bounces at zope.org 
> [mailto:zope3-users-bounces at zope.org] On Behalf Of Florian Lindner He
> Sent: Wednesday, May 17, 2006 7:10 PM
> To: zope3-users at zope.org
> Subject: [Zope3-Users] Calling method of superclass
> 
> Hello,
> should be a simple problem, but...
> 
> I have a class that is registered as a NameChooser:
> 
> from zope.app.container.contained import NameChooser
> 
>   class XGMNameChooser(NameChooser):
>     implements(INameChooser)
>     
>     def chooseName(self, name, object):
>         if IAbbreviation.providedBy(object):
>             [...]
>             return n
>         else:
>             return super(NameChooser, self).chooseName(name, object)

Try this:


class XGMNameChooser(NameChooser):
    implements(INameChooser)
     
    def chooseName(self, name, object):
        if IAbbreviation.providedBy(object):
            [...]
            return n
        else:
            return super(XGMNameChooser, self).chooseName(name, object)
                         ^^^^^^^^^^^^^^
Regards
Roger Ineichen


> I want to take care only of the objects that are of type 
> IAbbrevation. But I can't call the 
> 
> File "/home/florian/Desktop/zope/lib/python/xgm/xgm.py", line 
> 35, in chooseName
>     return super(NameChooser, self).chooseName(name, object)
> AttributeError: 'super' object has no attribute 'chooseName'
> 
> What am I doing wrong?
> 
> Florian
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
> 



More information about the Zope3-users mailing list