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