[Zope3-Users] Cloning interfaces/interface fields - how?
Adam Groszer
agroszer at gmail.com
Tue Feb 19 11:29:46 EST 2008
Hello Hermann,
Tuesday, February 19, 2008, 4:46:29 PM, you wrote:
HH> Hi,
HH> I'm over and over confronted with a simple pattern, where I need to clone
HH> interface field. For instance, I have the content object, which has an
HH> interface, e.g.:
HH> class IPersonSearch(Interface):
HH> name = copy.deepcopy(IPerson['name'])
Might not be the nicest solution, but works here.
You can do some magic too:
from zope.interface.interface import InterfaceClass
newIF = InterfaceClass(name=newname, __module__ = module,
attrs=newfields)
Where newfields is a dict with keys of name and values of fields
(deepcopied).
--
Best regards,
Adam Groszer mailto:agroszer at gmail.com
--
Quote of the day:
You can easily judge the character of a man by how he treats those who can do nothing for him.
- James D. Miles
More information about the Zope3-users
mailing list