[Zope] [Bug] refresh does not work for products initialized in the old style
Sven Rudolph
sven@spaghetticode.de
Wed, 27 Feb 2002 04:43:06 +0100
Hello Dieter.
> Recently, someone complaint about being unable to refresh his product.
Yes, it was me.
I posted it on Mon, 4 Feb 2002 00:55:27, and the subject was:
Zope-Error: Object of type "None" is not callable
> After the first refresh, he was unable create new instances of
> his product. He got an unintelligent error message:
> "AttributeError: None object does not have attribute _setObject"
Actually it was: 'Object of type "None" is not callable'
> I just found out why this happens:
>
> Products using old style initializations install their
> constructors as methods of "Folder.Folder".
>
> When the product is reinstalled during a refresh, then
> in "OFS.Application.install_product" it is checked whether
> "Folder.Folder" already has the method. It has! The
> old method from the time before the refresh.
> Therefore, the old constructors remain installed.
This would explain why ope didn't recognize any changes in my addFunction.
The traceback of "Object of type 'None' is not callable" told me, that the error is in my addFunction in the line:
handle=GMSBericht() (GMSBericht is the class of my product)
If I changed the line to something like:
handle=qwertz(GMSBericht(asdf())) (which is syntactically correct nonsense)
and did a refresh, the traceback after trying to create a new instance of my product was exactly the same(!).
As I posted earlier, the refresh worked well in 2.4.0, but not since 2.4.1.
> I do not yet understand, why a "self" that should be a folder
> is passed as None, but I am convinced it has to do with
> the outdated constructor in "Folder.Folder".
>
> Upgrading to new style initialization works around the problem.
Well, I don't think I understood your explanation. What is the difference between "old style" and "new style initialization"?
Thanks a lot for your posting!
Greetings
Sven Rudolph