Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tutorius/properties.py
diff options
context:
space:
mode:
authormike <michael.jmontcalm@gmail.com>2009-10-17 17:47:58 (GMT)
committer mike <michael.jmontcalm@gmail.com>2009-10-17 17:47:58 (GMT)
commit3b9bff2ef1826987d95815ff03c235052cea9aae (patch)
treeeac77f7221d54642ee7258e3bc8c2376d65c8900 /tutorius/properties.py
parent8ffa6e6e714a560d17e13f909625f143338e785b (diff)
LP 439980 : Code review changes : renamed is_identical to __eq__, relaxed action insertion constraints, added fixed meta-props for addons
Diffstat (limited to 'tutorius/properties.py')
-rw-r--r--tutorius/properties.py12
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