Create the object table only once and cache it
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 25 May 2015 20:58:12 +0000 (20:58 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 25 May 2015 20:58:12 +0000 (20:58 +0000)
src/collecty/plugins/base.py

index 32afb02..61a4682 100644 (file)
@@ -491,10 +491,17 @@ class GraphTemplate(object):
                        "file" : self.object,
                }
 
+       @property
+       def object_table(self):
+               if not hasattr(self, "_object_table"):
+                       self._object_table = self.get_object_table()
+
+               return self._object_table
+
        def get_object_files(self):
                files = {}
 
-               for id, obj in self.get_object_table().items():
+               for id, obj in self.object_table.items():
                        files[id] = obj.file
 
                return files