Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

ProtototypedFrom issue using ColorTrait (maybe all the mapped traits) #9

Open
dpinte opened this Issue · 0 comments

1 participant

@dpinte
Owner

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 <module>
    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_'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.