15 Jul 22:54
Re: probable bug in @on_trait_change with delegated lists
From: Danny Shevitz <shevitz@...>
Subject: Re: probable bug in @on_trait_change with delegated lists
Newsgroups: gmane.comp.python.enthought.devel
Date: 2008-07-15 20:54:21 GMT
Subject: Re: probable bug in @on_trait_change with delegated lists
Newsgroups: gmane.comp.python.enthought.devel
Date: 2008-07-15 20:54:21 GMT
> The subtlety is that in my code sub_contexts are delegated through a
> LogicElement via:
> context.sub_contexts = context.logic_element.sub_contexts
>
> I have a similar version of the code that does not use delegation and does not
> show the bug. It would seem that the bug is in the combination of catching
> changes to a delegated list using the '*' pattern.
More debugging...
If I had to guess, I think that the bug is that the pattern
@on_trait_change('object:list*')
when 'list' is delegated, is causing the wrong handler in traits_listener
to be used. I think traits_listener.py:522 "handle_list_items" should be used
but traits_listener.py:506 "handle_list" is being used instead. The result
is that handle_list is being handed old=Undefined, new=TraitListObject instead
of old=List, new=List.
I'm not sure why this is happening though...
D
RSS Feed