From 37fc375d5c1772484c6f200c0cc2816dc8c00048 Mon Sep 17 00:00:00 2001 From: paulfantom Date: Thu, 23 Jun 2016 18:08:55 +0200 Subject: [PATCH] do not escape everything --- python.d/example.chart.py | 2 +- python.d/python_modules/base.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/python.d/example.chart.py b/python.d/example.chart.py index ddf13c8c..bc1846b7 100644 --- a/python.d/example.chart.py +++ b/python.d/example.chart.py @@ -24,7 +24,7 @@ class Service(BaseService): def create(self): self.chart("example.python_random", '', 'A random number', 'random number', 'random', 'random', 'line', self.priority, self.update_every) - self.dimension('random1', '', 'absolute', 1, 1) + self.dimension('random1') self.commit() return True diff --git a/python.d/python_modules/base.py b/python.d/python_modules/base.py index 6796d9e0..1183c428 100644 --- a/python.d/python_modules/base.py +++ b/python.d/python_modules/base.py @@ -142,13 +142,14 @@ class BaseService(threading.Thread): Converts *params to string and joins them with one space between every one. :param params: str/int/float """ - self.data_stream += instruction + " " + self.data_stream += instruction for p in params: p = str(p) if len(p) == 0: - p = "" - self.data_stream += "'" + p - self.data_stream += "' " + p = "''" + if ' ' in p: + p = "'" + p + "'" + self.data_stream += " " + p self.data_stream += "\n" def chart(self, type_id, name="", title="", units="", family="", @@ -192,6 +193,8 @@ class BaseService(threading.Thread): divisor = 1 if name is None: name = id + if algorithm not in ("absolute", "incremental", "percentage-of-absolute-row", "percentage-of-incremental-row"): + algorithm = "absolute" self.dimensions.append(id) if hidden: -- 2.39.2