Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dpinte opened this issue Jul 11, 2011 · 0 comments
Open

Comments

@dpinte
Copy link
Member

dpinte commented Jul 11, 2011

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant