[Grok-dev] How to create an interface providing another interface
simon.elbaz at free.fr
simon.elbaz at free.fr
Wed Feb 4 13:02:04 EST 2009
Hi,
I try to create an interface providing another interface. It seems that this is possible in Zope3 by using the component.interface.provideInterface() function.
With grok, the following code triggers an error:
---
Code:
################################
class IAMenuItem(interfaces.IInterface):
pass
class AMenuItem(interface.Interface):
pass
component.interface.provideInterface('menuitem', AMenuItem, IAMenuItem)
component.interface.provideInterface('menuitem', AMenuItem, IMenuItemType)
################################
Error:
....
File "/usr/local/lib/python2.4/copy_reg.py", line 48, in _reconstructor
obj = object.__new__(cls)
TypeError: ('object.__new__(X): X is not a type object (InterfaceClass)', <function _reconstructor at 0xb7cc0f44>, (<InterfaceClass menutest.cdcmenu.AMenuItem>, <type 'object'>, None))
--
Even if the interface is implemented by a model:
class OtherMenuItem(grok.Model):
grok.implements(AMenuItem)
The same error is triggered.
Thanks for your help
Simon Elbaz
More information about the Grok-dev
mailing list