15 Jul 19:48
traits update broke my app
From: Danny Shevitz <shevitz@...>
Subject: traits update broke my app
Newsgroups: gmane.comp.python.enthought.devel
Date: 2008-07-15 17:50:18 GMT
Subject: traits update broke my app
Newsgroups: gmane.comp.python.enthought.devel
Date: 2008-07-15 17:50:18 GMT
>
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.
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
The traceback is:
Exception occurred in traits notification handler.
Please check the log file for details.
Exception occurred in traits notification handler for object: <elm_objects.Exten
dableContext object at 0x02DEAB70>, trait: sub_contexts, old value: <undefined>,
new value: <enthought.traits.trait_handlers.TraitListEvent object at 0x02F25DF0
>
Traceback (most recent call last):
(Continue reading)
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
RSS Feed