[Zope-dev] error adding specialist
Steve Alexander
steve@cat-box.net
Tue, 11 Jul 2000 13:36:05 +0100
I've come across an error on trying to add a Specialist.
Zope 2.2b4, ZPatterns latest release (ZPatterns-0-4-0a1).
Go to the zope management pages, as a Manager.
Choose to add a Specialist.
Leave the "Create Default Rack of type" drop-down set to "Rack".
Put in an appropiate id, such as "test".
Press "Add".
We get a Zope error:
Error Type: TypeError
Error Value: keyword parameter redefined
Traceback (innermost last):
File /usr/local/zope/SiteBox/lib/python/ZPublisher/Publish.py, line
222, in publish_module
File /usr/local/zope/SiteBox/lib/python/ZPublisher/Publish.py, line
187, in publish
File /usr/local/zope/SiteBox/lib/python/Zope/__init__.py, line 221, in
zpublisher_exception_hook
File /usr/local/zope/SiteBox/lib/python/ZPublisher/Publish.py, line
171, in publish
File /usr/local/zope/SiteBox/lib/python/ZPublisher/mapply.py, line
160, in mapply
(Object: manage_addSpecialist)
File /usr/local/zope/SiteBox/lib/python/ZPublisher/Publish.py, line
112, in call_object
(Object: manage_addSpecialist)
File
/usr/local/zope/SiteBox/lib/python/Products/ZPatterns/Specialists.py,
line 71, in manage_addSpecialist
File /usr/local/zope/SiteBox/lib/python/Products/ZPatterns/PlugIns.py,
line 436, in _constructPlugIn
TypeError: (see above)
The error occurs because the _constructPlugIn() method of PlugIns.py
attempts to give "id" to manage_addRack as a keyword argument, whereas
it has already been given the id as a positional argument. Actually, I
think what it is being given as an id is wrong too :-)
The offending line is 436:
return apply(getattr(product, method), (product,)+args, kwargs)
The rest of this is mainly for my benefit, and will be obvious to anyone
familiar with the code :-)
"getattr(product, method)" evaluates to the python method
manage_addRack, and it appears to be a bound method.
"product" is a __FactoryDispatcher__ instance.
"args" is None, or ().
"kwargs" is {'id': 'defaultRack'}.
The signature of manage_addRack() is:
def manage_addRack(self, id, title='', REQUEST=None):
and is effectively getting called as:
instance.manage_addRack(some __FactoryDispatcher__, id='defaultRack')
I'm not sure whether the method intended to get an unbound method rather
than a bound one, or whether "id" needs special handling here.
--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net