From 990806759e3270e7718b0c4c2828430e62056832 Mon Sep 17 00:00:00 2001 From: Tal Karbachinsky Date: Thu, 25 Jan 2018 13:59:15 +0200 Subject: Adding string encoder support Issue-ID: TEST-76 Change-Id: I805da261cd7ebb4ed4111f333cd3cd6225d87352 Signed-off-by: Tal Karbachinsky (cherry picked from commit d543b6489bd975f6261cdf31efbf3c9b4ac931b4) --- eteutils/StringTemplater.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eteutils/StringTemplater.py b/eteutils/StringTemplater.py index 680600f..36ddfab 100644 --- a/eteutils/StringTemplater.py +++ b/eteutils/StringTemplater.py @@ -1,3 +1,4 @@ +import json from string import Template class StringTemplater: @@ -5,4 +6,8 @@ class StringTemplater: def template_string(self, template, values): """Template String takes in a string and its values and converts it using the string.Template class""" - return Template(template).substitute(values) \ No newline at end of file + return Template(template).substitute(values) + + def string_Encoder(self,data): + data = json.dumps(data) + return data \ No newline at end of file -- cgit 1.2.3-korg