Re: [BlueBream] Referring to same interface using zope.schema.Object
Joshua Immanuel <[email protected]>
| Newsgroups | gmane.comp.web.zope.devel,gmane.comp.web.zope.bluebream |
|---|---|
| Organization | HiPro IT Solutions Private Limited |
| Message-ID | <1311340997.6500.1.camel@jimman> |
Hello Laurence, On Fri, 2011-07-22 at 13:57 +0100, Laurence Rowe wrote: > No, there are issues. Take this example: > > >>> class ITest(Interface): > ... title = schema.TextLine() > ... > >>> ITest.names > <bound method InterfaceClass.names of <InterfaceClass __main__.ITest>> > >>> ITest.names() > ['title'] > >>> ITest.description = schema.Text() > >>> ITest.names() > ['title'] > > The fields on an interface are not stored as attributes, but are > accessible using item access, e.g: ITest['title']. You cannot assign > that way though: > > >>> ITest['description'] = schema.TextLine() > Traceback (most recent call last): > File "<console>", line 1, in <module> > TypeError: 'InterfaceClass' object does not support item assignment > > Adding to an interface requires messing with the > '_InterfaceClass__attrs' attribute of the dictionary and is > discouraged. Thanks for enlightening me with this wonderful explanation. As Jacob mentioned, list(INode) in debug shell was very handy to debug. -- Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in _______________________________________________ Zope-Dev maillist - [email protected] https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
signature.asc
(application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEABECAAYFAk4peb4ACgkQWw85XwuSFMLwowCgl4uHmYdXvSUCf7lDMmkk/7YS QJkAn1EUAkKlqXFyq78QY7rtHAH0LfqJ =v21o -----END PGP SIGNATURE-----