[Chandler-dev] Getting rid of all __init__ methods (for Item subclasses)

Phillip J. Eby pje at telecommunity.com
Thu Mar 22 16:30:03 PST 2007


At 03:36 PM 3/22/2007 -0700, Andi Vajda wrote:

>On Thu, 22 Mar 2007, Phillip J. Eby wrote:
>
>>So, should I use _setInitialValues() in schema.Item.__init__ to do the 
>>attribute setting?  It seems like there may need to be more collaboration 
>>between schema.Item and repository.item.Item in order to enable the 
>>behavior I'm trying to add.
>
>How about passing in these initial values as keyword args to Repository's 
>Item __init__() instead (as has been the case so far) ?

They are computed using the item's state, so the item has to exist 
first.  E.g., in your own P2P plugin, see the various Share classes' 
__init__: they create attribute values based on other attributes, so their 
computation has to occur after the kwarg values are already set.

Based on our IRC conversation, I'll go ahead and use deferred observers and 
indexes for *setting* the values, though.



More information about the chandler-dev mailing list