diff options
Diffstat (limited to 'tutorius/properties.py')
-rw-r--r-- | tutorius/properties.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tutorius/properties.py b/tutorius/properties.py index 2afe119..4c34511 100644 --- a/tutorius/properties.py +++ b/tutorius/properties.py @@ -95,7 +95,7 @@ class TPropContainer(object): """ return object.__getattribute__(self, "_props").keys() - def is_identical(self, otherContainer): + def __eq__(self, otherContainer): """ Compare this property container to the other one and returns True only if the every property of the first one can be found in the other container, with @@ -108,6 +108,10 @@ class TPropContainer(object): # Make sure both have the same number of properties if len(self._props) != len(otherContainer._props): return False + + if not(type(self) == type(otherContainer)): + return False + # For every property in this container for prop in self._props.keys(): found = False @@ -131,12 +135,12 @@ class TPropContainer(object): # If this is just an embedded / decorated container, then we want to # make sure the sub component are identical. elif this_type == "addon": - if not self._props[prop].is_identical(otherContainer._props[prop]): + if not (self._props[prop] == otherContainer._props[prop]): return False found = True break else: - if self._props[prop]== otherContainer._props[prop]: + if self._props[prop] == otherContainer._props[prop]: found = True break # If we arrive here, then we couldn't find any property in the second @@ -161,7 +165,7 @@ class TPropContainer(object): # Attempt to match it with every property in the other list for other_container in otherList: # If the containers are identical, - if container.is_identical(other_container): + if container == other_container: # We found a matching container. We don't need to search in the # second list anymore, so we break found = True |