[Zope] Tricky (I think!) external method question...

Steven Sartorius ssartor@bellatlantic.net
Tue, 30 Oct 2001 17:55:18 -0500


on 10/30/01 14:31, Paul Winkler at slinkp23@yahoo.com wrote:

> On Tue, Oct 30, 2001 at 02:14:59PM -0500, Steven Sartorius wrote:
> (snip)
>> 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
> 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.

Do I feel like a maroon....

I had pulled that return out of the code but found I was still getting the
same error.  Guess I forgot to restart Zope and update the changed method.
When I restarted Zope from the Control Panel things worked as expected.

Thanks,


Steve