David C. Morrill | 16 Jul 00:41

Re: traits update broke my app

Danny Shevitz wrote:
>
> Howdy, 
>
> I'm not sure how to proceed with this one. I updated to the latest
> trunk version of /TUI. It has been a while (read months) since my last update. 
> My app, which was working fine, is now broken. 
>   

Try doing an svn unupdate :-)

On a more serious note...as written, you would not be receiving 
TraitListEvent objects for 'new', since those are only generated for the 
'foo_items' pseudo trait. Also, it's hard to tell from just two lines of 
code, but how is 'sub_contexts' defined? Is it a List, or a property 
whose value is a list? If it's the later, you may have a problem dealing 
with the pre-default value (i.e. Undefined). One of the changes that has 
occurred in the last month or so is the ability to define default values 
for Properties. Setting a default value of an empty list will probably 
fix your problem in this case...

Dave Morrill
> The breaking happens when drag and dropping an object off my tool palette onto
> a tree editor. I went into fbi and tried to figure out what's going on. I think
> the issue may be related to the handling of trait list events. IIUC, when you
> have TraitListEvents, the calling signature could be
> @on_trait_change('sub_contexts')
> def prototype(self, object, name, old, new) 
>
> except old never had value if new was a TraitListEvent. This seems to be 
> causing problems now, although I don't know why. Any ideas?
>
> thanks,
> D
>
>   

Gmane