[Zope] I get an error when calling "parent.__init__(self)"
Chris McDonough
chrism@zope.com
Thu, 30 Aug 2001 09:27:26 -0400
Search the archives for 'inheritedAttribute'... This is a limitation of
extension classes (most Zope classes are extension classes).
Max Møller Rasmussen wrote:
> I have a class, which contains the logic of a product.
>
> class msgList:
>
> def __init__(self):
> self.msgDict = {}
> self._newId = 0
>
> Then I have another class which takes care of the more Zope related tasks.
>
> class mxm_Discuss(SimpleItem.SimpleItem, msgList):
>
> def __init__(self, id, title):
> "Inits the product with default values"
> self.id = id
> self.title = title
> msgList.__init__(self) <-------- Line 22
>
> But when I try to instantiate it in Zope I get an error:
>
> "Error Type: TypeError
> Error Value: unbound method __init__() must be called with instance as first
> argument"
>
> Usually this error comes when I forget 'self' in a method. I cannot see what
> causes it here though.
>
> Has anybody got a clue? It's probably something simple I have overlooked.
>
> regards Max M
>
> Traceback (innermost last):
> File C:\zope\zope240\lib\python\ZPublisher\Publish.py, line 223, in
> publish_module
> File C:\zope\zope240\lib\python\ZPublisher\Publish.py, line 187, in
> publish
> File C:\zope\zope240\lib\python\Zope\__init__.py, line 226, in
> zpublisher_exception_hook
> File C:\zope\zope240\lib\python\ZPublisher\Publish.py, line 171, in
> publish
> File C:\zope\zope240\lib\python\ZPublisher\mapply.py, line 160, in mapply
> (Object: manage_addmxm_DiscussAction)
> File C:\zope\zope240\lib\python\ZPublisher\Publish.py, line 112, in
> call_object
> (Object: manage_addmxm_DiscussAction)
> File C:\zope\zope240\lib\python\Products\mxm_Discuss\mxm_Discuss.py, line
> 43, in manage_addmxm_DiscussAction
> File C:\zope\zope240\lib\python\Products\mxm_Discuss\mxm_Discuss.py, line
> 22, in __init__
> (Object: mxm_discuss)
> TypeError: (see above)
>
>
> - Nørgård Mikkelsen a/s -
> www.normik.dk - Vandværksvej 18 - DK 5000 Odense C
> Tlf (+45) 66 14 14 80 - Fax (+45) 66 14 19 43
> Max M - Direkte (+45) 63 14 47 15
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>
--
Chris McDonough Zope Corporation
http://www.zope.org http://www.zope.com
"Killing hundreds of birds with thousands of stones"