[Zope] how to instantiate an External Method

Wladmir Araujo Chapetta wladmir at gmail.com
Wed Apr 6 16:58:28 EDT 2005


How can i instantiate a external method within my Container Product? 
I've tryed to do this as following:

...
from Products.ExternalMethod import ExternalMethod

class Container(Folder):
        meta_type ='Container'

        
        
	def __init__(self, id, title):
                self.id = id
                self.title = title
                
....

        index_html = DTMLFile("dtml/indexContainer", globals())
        search = PythonScript(id='search')
        searchService=ExternalMethod('searchService','searchService','search','search')

.....

The id and title are "searchService" . The module and function name
are 'search'  and they are located in Extensions directory in my
Container Product.


The following error is printed:
File "/home/zope/Zope2.7.4/lib/python/OFS/Application.py", line 673,
in import_product
    product=__import__(pname, global_dict, global_dict, silly)
  File "/home/zope/Zope2.7.4/lib/python/Products/Container/__init__.py",
line 1, in ?
    import Container,ItemSimples
  File "/home/zope/Zope2.7.4/lib/python/Products/Container/Container.py",
line 22, in ?
    class Container(Folder):
  File "/home/zope/Zope2.7.4/lib/python/Products/Container/Container.py",
line 36, in Container
    searchService=ExternalMethod('searchService','searchService','search','search')
TypeError: 'module' object is not callable

How could i solve it?


More information about the Zope mailing list