@cryptotaxi247 / netdata-1 / commits / 37fc375d5

do not escape everything

paulfantom committed Jun 23, 2016 at 18:08 UTC 37fc375d5c1772484c6f200c0cc2816dc8c00048
2 files changed +8 -5
python.d/example.chart.py
+1 -1
@@ -24,7 +24,7 @@ class Service(BaseService):
24 def create(self):
25 self.chart("example.python_random", '', 'A random number', 'random number',
26 'random', 'random', 'line', self.priority, self.update_every)
27 - self.dimension('random1', '', 'absolute', 1, 1)
27 + self.dimension('random1')
28 self.commit()
29 return True
30
python.d/python_modules/base.py
+7 -4
@@ -142,13 +142,14 @@ class BaseService(threading.Thread):
142 Converts *params to string and joins them with one space between every one.
143 :param params: str/int/float
144 """
145 - self.data_stream += instruction + " "
145 + self.data_stream += instruction
146 for p in params:
147 p = str(p)
148 if len(p) == 0:
149 - p = ""
150 - self.data_stream += "'" + p
151 - self.data_stream += "' "
149 + p = "''"
150 + if ' ' in p:
151 + p = "'" + p + "'"
152 + self.data_stream += " " + p
153 self.data_stream += "\n"
154
155 def chart(self, type_id, name="", title="", units="", family="",
@@ -192,6 +193,8 @@ class BaseService(threading.Thread):
193 divisor = 1
194 if name is None:
195 name = id
196 + if algorithm not in ("absolute", "incremental", "percentage-of-absolute-row", "percentage-of-incremental-row"):
197 + algorithm = "absolute"
198
199 self.dimensions.append(id)
200 if hidden: