Fix formatter in some cases

This commit is contained in:
Florent 2013-12-18 10:15:39 +01:00
commit 27e0690f8b

View file

@ -42,13 +42,13 @@ class GaugeFormatter(IFormatter):
if not empty(obj.city): if not empty(obj.city):
city = obj.city city = obj.city
# TODO: can happens ? if not obj.sensors or (len(obj.sensors) == 0):
if len(obj.sensors) == 0: result = u' %s %s %s \n' %\
return u' %s %s %s' %\
(self.colored('%-27s' % name[:27], 'red'), (self.colored('%-27s' % name[:27], 'red'),
self.colored('%-10s' % obj.object[:10], 'yellow'), self.colored('%-10s' % obj.object[:10], 'yellow'),
self.colored('%-10s' % city[:10], 'yellow') self.colored('%-10s' % city[:10], 'yellow')
) )
result += u' %s \n' % self.colored('%-47s' % obj.fullid[:47], 'blue')
else: else:
first = True first = True
firstaddress = obj.sensors[0].address firstaddress = obj.sensors[0].address
@ -88,7 +88,7 @@ class GaugeFormatter(IFormatter):
result += u' %s \n' %\ result += u' %s \n' %\
self.colored('%-33s' % sensor.address[:33], 'yellow') self.colored('%-33s' % sensor.address[:33], 'yellow')
return result return result
class Boobsize(ReplApplication): class Boobsize(ReplApplication):