enthought / enthought/traits

ProtototypedFrom issue using ColorTrait (maybe all the mapped traits)

Open
#9 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
462
Forks
90
PR merge metrics
No merged PRs in 30d

Description

Here is a simple test case ::

```
from traits.api import HasTraits, PrototypedFrom, Instance
from enable.api import ColorTrait

class Configuration (HasTraits):

line_color = ColorTrait('red')

class Plot(HasTraits):

config = Instance(Configuration, ())
line_color = PrototypedFrom('config')

if __name__ == '__main__':

s = Plot()

print s.line_color

# raises a KeyError on line_color_
s.line_color = 'black'
```

Executing the code leads to the following traceback ::

```
dpinte:Downloads dpinte$ python bug_delagated_mapped_traits.py
red
Traceback (most recent call last):
File "bug_delagated_mapped_traits.py", line 21, in
s.line_color = 'black'
File "/Users/dpinte/projects/ets/traits/traits/trait_handlers.py", line 2124, in _post_setattr
setattr( object, name + '_', value )
File "/Users/dpinte/projects/ets/traits/traits/has_traits.py", line 3703, in _remove_trait_delegate_listener
name, self.__class__.__listener_traits__[ name ][1] ),
KeyError: 'line_color_'
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.