[Zope] ZGDCart problem
Sylvain Thénault
Sylvain.Thenault at logilab.fr
Wed Feb 11 17:49:55 EST 2004
On Tuesday 10 February à 19:36, Dieter Maurer wrote:
> 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.
I've encountered a similar problem which I could not understand for now:
I've a Zope product using a regular python package. The problem is that
the same kind of TypeError is raised _in the python package_, where no
class knows anything about ExtensionClass (I mean there is no
ExtensionClass.Base in the classes hierarchy) !
I can't find this documented anywhere. Does someone ever encountered
such a problem ?
Or does someone could affirm that this is impossible, and the product
is doing something nasty ?
Using the same trick as Dieter explained fixes the problem, but I really
don't feel good to have to do this in an external product.
--
Sylvain Thénault LOGILAB, Paris (France).
http://www.logilab.com http://www.logilab.fr http://www.logilab.org
More information about the Zope
mailing list