From 154752ce6169093a36ffeb3cce3c408e1da2d3b2 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Thu, 26 Jan 2006 23:39:55 +0000 Subject: Modify python helpers to use flat configuration file structure. --- tools/rrdui.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tools') diff --git a/tools/rrdui.py b/tools/rrdui.py index ee10eae..a4debf4 100644 --- a/tools/rrdui.py +++ b/tools/rrdui.py @@ -18,10 +18,10 @@ class GraphDef: __config = None - def __init__(self, category, name): - self.filename = "%s/%s/%s" % (CONFDIR, category, name) - self.filedata = "%s/%s-%s.rrd" % (WORKDIR, category, name) - self.category = category + def __init__(self, name): + self.filename = "%s/%s" % (CONFDIR, name) + self.filedata = "%s/%s.rrd" % (WORKDIR, name) + self.category = "All" self.name = name cfg = self.__config = ConfigParser.RawConfigParser() @@ -30,6 +30,8 @@ class GraphDef: # Loading general stuff if cfg.has_option("general", "title"): self.title = cfg.get("general", "title") + if cfg.has_option("general", "category"): + self.title = cfg.get("general", "category") # Loading graph stuff if cfg.has_option("graph", "width"): @@ -85,12 +87,10 @@ def loadGraphs(): # List files and add appropriate paths graphs = [] - for category in os.listdir(CONFDIR): - dir = "%s/%s" % (CONFDIR, category) - if not os.path.isdir(dir): + for file in os.listdir(CONFDIR): + if os.path.isdir(file): continue - for f in os.listdir(dir): - graphs.append(GraphDef(category, f)) + graphs.append(GraphDef(file)) return graphs -- cgit v1.2.3