[Erp5-dev] external methods seems to not keep the calling context

Morin Fabien fabien at nexedi.com
Fri Dec 28 17:13:14 CET 2007


Hello,
I have a very strange error :
an ExternalMethod is called with **kw parameters, and I have the
following TypeError :
ERP5Site_createModuleScribus() takes at least 1 non-keyword argument (0
given)
this append in Base_callDialogMethod.py on line 201 : 
return dialog_form(**kw)
where dialog_form is an external method with the following prototype :
def createModuleScribus(self, form_id=None, module_portal_type=None,
portal_skins_folder=None, object_portal_type=None, object_title=None, module_id=None,
module_title=None, selection_index=None, selection_name=None, import_scribus_file=None,
import_pdf_file=None, option_html=None,desired_height=None, desired_width=None, import_image_1=None, import_image_2=None,
import_image_3=None, **kw) :

The error disapear if the dialog_form is called like this : return
dialog_form(context, **kw)

According to the external method doc string, pass context is not
mandatory, so it's quite strange...


Any Idea ?


I'm using
Zope Version : (Zope 2.8.9.1-final, python 2.4.4, linux2) 
Python Version : 2.4.4 (#2, Oct 20 2007, 22:07:32) [GCC 4.1.2 20070302
(prerelease) (4.1.2-1mdv2007.1)] 


Fabien
-------------- next part --------------
"""Call an ExternalMethod

Calling an External Method is roughly equivalent to calling
the original actual function from Python.  Positional and
keyword parameters can be passed as usual.  Note however that
unlike the case of a normal Python method, the "self" argument
must be passed explicitly.  An exception to this rule is made
if:

- The supplied number of arguments is one less than the
required number of arguments, and

- The name of the function\'s first argument is 'self'.

In this case, the URL parent of the object is supplied as the
first argument.



More information about the Erp5-dev mailing list