[Zope] Zope-Error: Object of type "None" is not callable

Sven Rudolph sven@spaghetticode.de
Mon, 4 Feb 2002 00:55:27 +0100


Hello to you all!

I have a pretty confusing problem :-/
I wrote a product called GMSBericht for publishing news.
I started development on zope-2.4.0, and continued working on it through 2.4.2, 2.4.3 and now 2.5.0.
The product is refreshable so I don't have to restart the server when I change the python code.
Somwhere in the 2.4.2 time zope started to behave strange. When I refreshed my product I was unable to create new instances of it any more. I had to restart the server to be able to create new instances of GMSBericht, until the next refresh.
As you can imagin, this makes development rather painfull.
When I try to create a new instance of GMSBericht after refreshing it, I get the following error message:

Error Type: TypeError
Error Value: object of type 'None' is not callable
 
The traceback is:
Traceback (innermost last):
  File /home/sven/zope-2.5.0/lib/python/ZPublisher/Publish.py, line 150, in publish_module
  File /home/sven/zope-2.5.0/lib/python/ZPublisher/Publish.py, line 114, in publish
  File /home/sven/zope-2.5.0/lib/python/Zope/__init__.py, line 158, in zpublisher_exception_hook
    (Object: GMS)
  File /home/sven/zope-2.5.0/lib/python/ZPublisher/Publish.py, line 98, in publish
  File /home/sven/zope-2.5.0/lib/python/ZPublisher/mapply.py, line 88, in mapply
    (Object: addGMSBericht)
  File /home/sven/zope-2.5.0/lib/python/ZPublisher/Publish.py, line 39, in call_object
    (Object: addGMSBericht)
  File /home/sven/zope-2.5.0/lib/python/Products/GMSBericht/GMSBericht.py, line 169, in addGMSBericht
    (Object: GMS)
TypeError: (see above)

Line 169 of GMSBericht.py is in the add function:
def addGMSBericht(self,id,title,RESPONSE,REQUEST):
    """Legt ein Objekt vom Typ GMSBericht an"""

    handle = GMSBericht()      <---This is line 169!!
    handle.id=id
    handle.title=title
    self._setObject(id,handle)

    if REQUEST.form['submit'] == 'Anlegen und editieren!':
        RESPONSE.redirect(id+'/editcontent')
    else:
        RESPONSE.redirect('manage_main')

(Note: GMS is a folder)

As you can see, this is just "standard code". And I never changed it since the first version of my product!
(Note: My product never had an __init__() function, so "handle=GMSBericht()" executes no code of my own)
But after switching to 2.4.2 the described problem appeared and never vanished with 2.4.3 and 2.5.0.
I found an old version of my product on my first 2.4.0 installation. I started this server again and tested the behaviour after a refresh, and no error occured. After this I copied the very same source code from $OLDSERVER/lib/python/Products/GMSBericht to a new installation of zope-2.5.0 and the error described above appeared. Then I tested it the other way arround. I took the newest version of my product and copied it to my old server installation, and no error occured after a refresh of my product. Finally I made a new installation of 2.4.0, installed my product (new and old version) and tested the behaviour after "refresh" and no error occured.

Unfortunately I need the new features of 2.5.0, so can't just use 2.4.0 (This wouldn't be a real solution).

Has anybody encounterd the same problem, or is this a known zope bug?
Can anybody help me?

Thanks in advance!

Greetings

Sven Rudolph