diff options
author | erick <erick@sugar-dev-erick.(none)> | 2009-10-30 22:21:54 (GMT) |
---|---|---|
committer | erick <erick@sugar-dev-erick.(none)> | 2009-10-30 22:21:54 (GMT) |
commit | a023cce7ec486c85234bc25ad1740191c920d454 (patch) | |
tree | d6ec477c638771e8545bde5d7338c9d5073a15db /tutorius/properties.py | |
parent | 37e2ab5dd552be9aec49ccf774c90da8b962ea9f (diff) |
Tutorial: Changed Tutorial.update_* to update properties instead of replacing the object, Moved validation of state name to a decorator to avoid dupliation
Diffstat (limited to 'tutorius/properties.py')
-rw-r--r-- | tutorius/properties.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tutorius/properties.py b/tutorius/properties.py index a675ba9..427222b 100644 --- a/tutorius/properties.py +++ b/tutorius/properties.py @@ -19,7 +19,7 @@ TutoriusProperties have the same behaviour as python properties (assuming you also use the TPropContainer), with the added benefit of having builtin dialog prompts and constraint validation. """ -from copy import copy +from copy import copy, deepcopy from .constraints import Constraint, \ UpperLimitConstraint, LowerLimitConstraint, \ @@ -93,8 +93,16 @@ class TPropContainer(object): """ Return the list of property names. """ + # Why isn't it simply: + # return self._props.keys() ? return object.__getattribute__(self, "_props").keys() + def get_properties_dict_copy(self): + """ + Return a deep copy of the dictionary of properties from that object. + """ + return deepcopy(self._props) + # Providing the hash methods necessary to use TPropContainers # in a dictionary, according to their properties def __hash__(self): |