[Zope3-Users] Interfaces with circular references
Markus Kemmerling
markus.kemmerling at meduniwien.ac.at
Fri Sep 21 08:40:09 EDT 2007
Hi Hermann,
Am 21.09.2007 um 14:03 schrieb Hermann Himmelbauer:
> Hi,
> Does someone know how to create interfaces with circular references?
>
> E.g.:
>
> class IHusband(Interface):
> wife = Object(schema=IWife)
>
> class IWife(Interface):
> husband = Object(schema=IHusband)
>
> What's the suggested solution to this problem?
>
> Perhaps I should modify the classes after they are declared, e.g.:
>
> class IHusband(Interface):
> pass
>
> class IWife(Interface):
> pass
>
> IHusband.wife = Object(schema = IWife)
> IWife.husband = Object(schema = IHusband)
>
> Or is there a better solution?
>
I don't think dot notation works for schema fields, you should use
mapping notation. Otherwise I had a similar problem some time ago and
coded it similarly, although slightly simpler:
class IHusband(Interface):
wife = Object(schema= Interface)
class IWife(Interface):
husband = Object(schema= IHusband)
IHusband['wife '].schema = IWife
Regards,
Markus Kemmerling
___________________
Medical University Vienna
Core Unit for Medical Education
P.O. Box 10 A-1097 Vienna
phone: +43-1-40 160-36 863 fax: +43-1-40 160-93 65 00
http://www.meduniwien.ac.at/bemaw/
> Best Regards,
> Herman
>
> --
> x1 at aon.at
> GPG key ID: 299893C7 (on keyservers)
> FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7
More information about the Zope3-users
mailing list