[Zope] ZGDCart problem

Dieter Maurer dieter at handshake.de
Tue Feb 10 13:36:56 EST 2004


Dennis Allison wrote at 2004-2-9 09:25 -0800:
>I just installed the product ZGDChart-0.6.5.tar.gz.  It unpacks and 
>installs, but when I try to make an instance it dies with the diagnostic
>-----------
>TypeError
>Exception Value unbound method __init__() must be called with instance as
>first argument
> ...
>The error seems to be here:
>
>    def __init__(self, id='ZGDChart', title='ZGDChart', height=250, width=250,
>        SQL=None, chart_type='Bar_3D', option=['xaxis', 'yaxis', 'grid',
>'border']):
>
>        GDChart.GDChart.__init__(self, id=id, title=title, height=height,
>width=width, SQL=SQL, chart_type=chart_type, option=option)

Change this to:

    __super_init = GDChart.GDChart.__init__

    def __init__(self, id='ZGDChart', title='ZGDChart', height=250, width=250,
        SQL=None, chart_type='Bar_3D', option=['xaxis', 'yaxis', 'grid', 'border']):

        self.__super_init(id=id, title=title, height=height,
                          width=width, SQL=SQL, chart_type=chart_type, option=option)


This is the standard way to work around such "TypeError"s.

The "ExtensionClass" documentation tells you why this error occurs
and a different work around.

-- 
Dieter



More information about the Zope mailing list