Skip to content
This repository has been archived by the owner on May 24, 2021. It is now read-only.

Commit

Permalink
Critical bug-fix class_traits interaction.
Browse files Browse the repository at this point in the history
This bug could cause an attribute add to fail, when it shouldn't.
A check for the Disallow trait fixes that.
  • Loading branch information
sccolbert committed Dec 11, 2012
1 parent 0c22537 commit 25755e2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions enaml/core/declarative.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,12 @@ class and is not a user defined attribute, an exception will be
class_traits = cls.__class_traits__
if name in class_traits:
trait_type = class_traits[name].trait_type
if not isinstance(trait_type, (UserAttribute, UserEvent)):
msg = ("can't add '%s' attribute. The '%s' attribute on "
"enamldef '%s.%s' already exists.")
items = (name, name, cls.__module__, cls.__name__)
raise TypeError(msg % items)
if trait_type is not Disallow:
if not isinstance(trait_type, (UserAttribute, UserEvent)):
msg = ("can't add '%s' attribute. The '%s' attribute on "
"enamldef '%s.%s' already exists.")
items = (name, name, cls.__module__, cls.__name__)
raise TypeError(msg % items)

trait_cls = UserEvent if is_event else UserAttribute
try:
Expand Down

0 comments on commit 25755e2

Please sign in to comment.