[Zope] how to instantiate an External Method

Dieter Maurer dieter at handshake.de
Thu Apr 7 14:50:59 EDT 2005


Wladmir Araujo Chapetta wrote at 2005-4-6 17:58 -0300:
> ...
>line 36, in Container
>    searchService=ExternalMethod('searchService','searchService','search','search')
>TypeError: 'module' object is not callable

A nice and precise error message:

  "ExternalMethod" is the module and not the class (as you expect).
  And the module is not callable.

Try:

   from Products.ExternalMethod.ExternalMethod import ExternalMethod


Note that after this change, your code above will only work
when "search.py" is located in your global "Extensions" folder.

For product specific ExternalMethods, they usually are better
located in the product's "Extensions" folder.
In this case, the module spec must take the form "product.module".

-- 
Dieter


More information about the Zope mailing list