Allow subfolders to be reached as attributes
authorMerlijn van Deen (valhallasw) <valhallasw+prune@gmail.com>
Mon, 26 Sep 2011 08:41:41 +0000 (10:41 +0200)
committerMerlijn van Deen (valhallasw) <valhallasw+prune@gmail.com>
Mon, 26 Sep 2011 08:41:41 +0000 (10:41 +0200)
igor.py

diff --git a/igor.py b/igor.py
index 16704bea4194c69b63540df0ee4ce4f079537b3f..dde15622557f8e7c1416b5904d528374aa2bba03 100644 (file)
--- a/igor.py
+++ b/igor.py
@@ -289,6 +289,11 @@ class Folder(object):
             
     def append(self, record):
         self.children.append(record)
+        try:
+            setattr(self, record.name, record)
+        except AttributeError:
+            pass
+        
     def format(self, indent=0):
         parent = u" "*indent+self.name
         children = [r.format(indent=indent+2) for r in self.children]