[Zope] Tricky (I think!) external method question...
Tue, 30 Oct 2001 14:31:56 -0500
On Tue, Oct 30, 2001 at 02:14:59PM -0500, Steven Sartorius wrote:
> import MyClass
> class MySubClass(MyClass.MyClass):
> def __init__(self,a,b,c):
> """Do some initialization that differs from MyClass"""
> return d
That's your problem right there. This is not a Zope problem - python
won't let you do that. You can't get a return value from __init__().
Try something similar at the python prompt:
Python 2.1.1 (#3, Oct 15 2001, 23:37:14)
[GCC 2.96 20000731 (Red Hat Linux 7.0)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> class Foo:
... def __init__(self):
... return 1
>>> c = Foo()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: __init__() should return None
I tried it with python 1.5.2, same result.
> The External Method above dies when it tries to create 'd'. The traceback I
> get from Zope says:
> Error Type: TypeError
> Error Value: __init__() should return None
> I'm stumped by this. I think there is some sort of namespace confusion
> going on but I'm not sure. If anyone can shed any light on this (and save
> some of my hair!) I'd appreciate it.