Fix encoding of title and vlabel

This commit is contained in:
Florent 2013-03-01 22:49:24 +01:00 committed by Romain Bignon
commit 3a0a8969e9
2 changed files with 7 additions and 4 deletions

View file

@ -131,6 +131,8 @@ env.label name
# Temperature in Rennes
[temprennes]
user florent
env.cache_expire 7200
env.HOME /home/flo
env.capa ICapWeather
@ -140,3 +142,4 @@ env.attribvalue temp/value
env.attribid temp/id
env.title Température à Rennes
env.vlabel Température
env.label id

View file

@ -58,13 +58,13 @@ class GenericMuninPlugin(object):
self.attribvalue = os.environ['attribvalue']
self.title = ''
if 'title' in os.environ:
self.title = os.environ['title']
self.title = os.environ['title'].decode('utf-8')
self.attriblabel = "label"
if 'label' in os.environ:
self.attriblabel = os.environ['label']
self.vlabel = self.attribvalue
if 'vlabel' in os.environ:
self.vlabel = os.environ['vlabel']
self.vlabel = os.environ['vlabel'].decode('utf-8')
def display_help(self):
@ -176,8 +176,8 @@ class GenericMuninPlugin(object):
self.new_cache('%s-config' % self.name)
self.weboob.load_backends(self.capa)
self.write_output('graph_title %s' % self.title)
self.write_output('graph_vlabel %s' % self.vlabel)
self.write_output('graph_title %s' % self.title.encode('iso-8859-15'))
self.write_output('graph_vlabel %s' % self.vlabel.encode('iso-8859-15'))
self.write_output('graph_category weboob')
self.write_output('graph_args -l 0')
try: