summaryrefslogtreecommitdiffstats
path: root/eteutils/StringTemplater.py
blob: 36ddfab6ddd32ec7a700169e54a7bcb5b6aff20d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import json
from string import Template

class StringTemplater:
    """StringTemplater is common resource for templating with strings."""
    
    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) 
		
    def string_Encoder(self,data):
        data = json.dumps(data)
        return data