Hi, I have the following constructor for an external product I build. def manage_addEba(dispatcher, id='eba', title='Title here',REQUEST=None): "Add a Basis element to a folder." nEba=eba(id,title) dispatcher.Destination()._setObject(id, nEba) if REQUEST is not None: dispatcher.manage_main(dispatcher,REQUEST) manage_addEbaForm = DTMLFile('dtml/manage_addEbaForm', globals()) We are upgrading to Zope 2.8.1. Now I get the follwing error when I try to add the product (eba). Error Type: TypeError Error Value: unbound method manage_addEba() must be called with eba instance as first argument (got str instance instead) Can anyone shed some some light on this? Thanks, Henny
Can you show us your __init__ stuff? 2005/10/13, Henny van der Linde <linde@inline-info.nl>:
Hi,
I have the following constructor for an external product I build.
def manage_addEba(dispatcher, id='eba', title='Title here',REQUEST=None): "Add a Basis element to a folder." nEba=eba(id,title) dispatcher.Destination()._setObject(id, nEba) if REQUEST is not None: dispatcher.manage_main(dispatcher,REQUEST)
manage_addEbaForm = DTMLFile('dtml/manage_addEbaForm', globals())
We are upgrading to Zope 2.8.1. Now I get the follwing error when I try to add the product (eba).
Error Type: TypeError Error Value: unbound method manage_addEba() must be called with eba instance as first argument (got str instance instead)
Can anyone shed some some light on this?
Thanks,
Henny
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com
----- Original Message ----- From: "Peter Bengtsson" <peter@fry-it.com> To: "Henny van der Linde" <linde@inline-info.nl> Cc: <zope@zope.org> Sent: Thursday, October 13, 2005 7:33 PM Subject: Re: [Zope] constructor product in Zope 2.8.1 Can you show us your __init__ stuff? Yes Here it is: from eba import eba from ImageFile import ImageFile def initialize(context): context.registerClass( eba, constructors = ( eba.manage_addEbaForm, eba.manage_addEba ), icon="www/eba.gif" ) misc_ = {"inst.gif": ImageFile("www/inst.gif",globals()), "k1.png": ImageFile("www/k1.png",globals()), "k2.png": ImageFile("www/k2.png",globals()), "k3.png": ImageFile("www/k3.png",globals()), "lock.png": ImageFile("www/lock.png",globals()), "unlock.png": ImageFile("www/unlock.png",globals()), "vink_16.gif": ImageFile("www/vink_16.gif",globals()), "kruisje_16.gif": ImageFile("www/kruisje_16.gif",globals()), "image.gif": ImageFile("www/image.gif",globals()), "print_icon.gif": ImageFile("www/print_icon.gif",globals()), "up.gif": ImageFile("www/up.gif",globals()), "pre.gif": ImageFile("www/pre.gif",globals()), "toolbar.gif": ImageFile("www/toolbar.gif",globals()), "nieuw_32.png": ImageFile("www/nieuw_32.png",globals()), "wis_32.png": ImageFile("www/wis_32.png",globals()), "hernummeren_32.png": ImageFile("www/hernummeren_32.png",globals()), "basis_32.png": ImageFile("www/basis_32.png",globals()), "specifiek_32.png": ImageFile("www/specifiek_32.png",globals()), "editors_32.gif": ImageFile("www/editors_32.gif",globals()), "site_32.png": ImageFile("www/site_32.png",globals()), "bewaren_32.png": ImageFile("www/bewaren_32.png",globals()), "annuleren_32.png": ImageFile("www/annuleren_32.png",globals()), } Henny van der Linde
Can you show us your __init__ stuff?
Yes
Here it is:
from eba import eba
def initialize(context): context.registerClass( eba, constructors = ( eba.manage_addEbaForm, eba.manage_addEba ), icon="www/eba.gif"
There's your problem! Is "eba" a folder or a file (ie. eba.py) If it's a file, then what you're saying is this:: from eba.py import <eba the class> context.registerClass(<eba the class>, constructors= (<eba the class>.manage_addEbaForm, ... But, "manage_addEbaForm" isn't a method of the class "eba", it's a function of the module eba.py Solution: import eba context.registerClass(eba.eba, constructors = (eba.manage_addebaForm, ......
)
misc_ = {"inst.gif": ImageFile("www/inst.gif",globals()),
"k1.png": ImageFile("www/k1.png",globals()),
"k2.png": ImageFile("www/k2.png",globals()),
"k3.png": ImageFile("www/k3.png",globals()),
"lock.png": ImageFile("www/lock.png",globals()),
"unlock.png": ImageFile("www/unlock.png",globals()),
"vink_16.gif": ImageFile("www/vink_16.gif",globals()),
"kruisje_16.gif": ImageFile("www/kruisje_16.gif",globals()),
"image.gif": ImageFile("www/image.gif",globals()),
"print_icon.gif": ImageFile("www/print_icon.gif",globals()),
"up.gif": ImageFile("www/up.gif",globals()),
"pre.gif": ImageFile("www/pre.gif",globals()),
"toolbar.gif": ImageFile("www/toolbar.gif",globals()),
"nieuw_32.png": ImageFile("www/nieuw_32.png",globals()),
"wis_32.png": ImageFile("www/wis_32.png",globals()),
"hernummeren_32.png": ImageFile("www/hernummeren_32.png",globals()),
"basis_32.png": ImageFile("www/basis_32.png",globals()),
"specifiek_32.png": ImageFile("www/specifiek_32.png",globals()),
"editors_32.gif": ImageFile("www/editors_32.gif",globals()),
"site_32.png": ImageFile("www/site_32.png",globals()),
"bewaren_32.png": ImageFile("www/bewaren_32.png",globals()),
"annuleren_32.png": ImageFile("www/annuleren_32.png",globals()),
}
Henny van der Linde
-- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com
participants (3)
-
Henny van der Linde -
Henny van der Linde (zettai) -
Peter Bengtsson