From: Merlijn van Deen (valhallasw) Date: Mon, 26 Sep 2011 08:41:41 +0000 (+0200) Subject: Allow subfolders to be reached as attributes X-Git-Tag: v0.2~24^2~5^2^2~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e0b04e48028708b3bd1ea8c85bb0824599ec9584;p=igor.git Allow subfolders to be reached as attributes --- diff --git a/igor.py b/igor.py index 16704be..dde1562 100644 --- 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]