summaryrefslogtreecommitdiff
path: root/reconfigure/nodes.py
diff options
context:
space:
mode:
Diffstat (limited to 'reconfigure/nodes.py')
-rw-r--r--reconfigure/nodes.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/reconfigure/nodes.py b/reconfigure/nodes.py
index 3335ad5..8c2c2d4 100644
--- a/reconfigure/nodes.py
+++ b/reconfigure/nodes.py
@@ -25,6 +25,8 @@ class Node (object):
s += ' (%s)' % self.comment
s += '\n'
for child in self.children:
+ if child.origin != self.origin:
+ s += '\t@%s\n' % child.origin
s += '\n'.join('\t' + x for x in str(child).splitlines()) + '\n'
return s
@@ -126,7 +128,7 @@ class Node (object):
Creates or replaces a child :class:`PropertyNode` by name.
"""
node = self.get(name)
- if not node:
+ if node is None:
node = PropertyNode(name, value)
self.append(node)
node.value = value
@@ -160,6 +162,9 @@ class PropertyNode (Node):
Node.__eq__(self, other) and \
self.value == other.value
+ def __hash__(self):
+ return Node.__hash__(self) + hash(self.value)
+
def __str__(self):
s = '%s = %s' % (self.name, self.value)
if self.comment: