[Pyobjc-dev] python properties and the bridge
Brought to you by:
ronaldoussoren
|
From: Matt A. <man...@gm...> - 2009-02-27 21:50:01
|
I have a python property (created with the builtin type "property") named <key> in a class derived from NSObject. Getting and setting the property seem to work just fine with the normal python syntax. Key-value coding ends up calling the getter and setter (as long as there is not a variable named '_<key>'; if there is, it gets set directly without the setter being called). However, if I call willChangeValueForKey_ on that class, with <key> as argument, the lookup fails and valueForUndefinedKey_ is called. Now, functionality-wise, everything seems to go back to working if I also implement `valueForUndefinedKey_`. In this case, it's an exceedingly simple implementation: def valueForUndefinedKey_(self, key): return getattr(self,key) Can anyone shed light on why the lookup for willChangeValueForKey_ fails? Is there any other way of solving this issue other than implementing valueForUndefinedKey_ as I have above? Thanks! Matt |