[Zope] Problems with PluginContainer

Antonio Beamud Montero antonio.beamud@agoratechnologies.com
17 Oct 2001 16:43:40 +0200


Hello all:
I'm a new Zope developer and I a bit confused with the Plugins Model...
I have created a Plugin container and a Plugin. 
All works ok, but when I try to view the Plugin Container management
interface Zope return me an error.

The teory is (Summarized):
MyPluginContainer extends PlugInContainer and adds something like this:

class foo(PlugInContainer):
"""Foo foo"""
meta_type = 'foo'
__implements__= Prueba


Confs = PlugInGroup('Configuraciones', ['Configuraciones'],
attr='listaPlugins')

__plugin_groups__ = (Confs)

def __init__(self, id)
    self.id = id
    self.listaPlugins = []

...
###########################################################
The plugin is like this:
class miPlugin(PlugIn):     
    """ miplugin """
    meta_type  = 'miPlugin'
    __plugin_kind__ = 'Configuraciones'
    __implements__ = Machine
    def __init__(self, id):
        self.id = id

    (other methods)

manage_addMiPluginForm = DTMLFile('addMiPlugin', globals())

def manage_addMiPlugin(self, id, REQUEST=None):
    """ Creamos una maquina"""
    obj = miPlugin(id)
    return self.Destination()._installPlugIn(obj, "Configurador,
REQUEST) 
###############################################################
And in the __init__.py:

def initialize(context):
        context.registerClass(
            foo,
            meta_type='foo',
            constructors = (
                manage_addfooForm,
                manage_addfoo),
            icon = 'www/hada.png'
        )    
        context.registerPlugInClass(
                miPlugin, 
                'miMaquina',
                permission = 'add plugin miPlugin',
                constructors = (manage_addMiPluginForm,
                                manage_addMiPlugin),   
    )

The error that zope give me is:

Error Type: AttributeError
Error Value: __len__

------

File /usr/local/Zope-2.4.1-linux2-x86/lib/python/App/Management.py, line
143, in manage_workspace
    (Object: PlugInBase)
  File /usr/local/Zope-2.4.1-linux2-x86/lib/python/App/Management.py,
line 115, in filtered_manage_options
    (Object: PlugInBase)
  File
/usr/local/Zope-2.4.1-linux2-x86/lib/python/Products/PlugIns/PlugIns.py,
line 187, in manage_options
    (Object: PlugInBase)
AttributeError: (see above)

Can anybody help me? please