diff --git a/cccli/command/list.py b/cccli/command/list.py index 5a3d74852f216b20e8e2bdb1b3dae07deb21e559..c405adbda0af61b88a568449ceb325cd8fcfd4a3 100644 --- a/cccli/command/list.py +++ b/cccli/command/list.py @@ -63,7 +63,7 @@ class Command_list(OptionCommand): tags = dict() for o in objs: for t,v in o.items(): - tags[t] = max(len(self.td(t, v)), tags.get(t, len(str(t)))) + tags[t] = max(len(self.td(t, v)), tags.get(t, len(t))) # extract id size idsize = tags.pop("id") # dislay each object by line @@ -77,7 +77,7 @@ class Command_list(OptionCommand): line += "%s%s:%s%s"%(color["reset"], tagname, self.tc(tagname), - self.td(tagname, o.get(tagname, "")).ljust(tags[tagname] + 1)) + self.td(tagname, o.get(tagname, u"")).ljust(tags[tagname] + 1)) self.printer.out("%s%s"%(line, color["reset"])) def _list_table(self, objs): @@ -86,7 +86,7 @@ class Command_list(OptionCommand): tags = dict() for o in objs: for t,v in o.items(): - tags[t] = max(len(self.td(t, v)), tags.get(t, len(str(t)))) + tags[t] = max(len(self.td(t, v)), tags.get(t, len(t))) # extract id size idsize = tags.pop("id") # print id title @@ -104,5 +104,5 @@ class Command_list(OptionCommand): # print others tags for (t, v) in tags.items(): self.printer.out(self.tc(t), nl="") - self.printer.out(self.td(t, obj.get(t, "")).ljust(v) ,nl=" ") + self.printer.out(self.td(t, obj.get(t, u"")).ljust(v) ,nl=" ") self.printer.out(color["reset"]) diff --git a/cccli/tagdisplay.py b/cccli/tagdisplay.py index c87aee498a01dc6776bb443cdbb776ebdbfccf18..50fced81d56656dbe9ce897762f1b894f8fb997d 100644 --- a/cccli/tagdisplay.py +++ b/cccli/tagdisplay.py @@ -117,7 +117,7 @@ class TagDisplay(object): p = min(math.floor(math.log10(abs(v))/3.0), len(si)) d = v / pow(10, 3*p) u = si[int(p-1)] - value = "%.1f%s"%(d, u) + value = u"%.1f%s"%(d, u) return value def type_bit(self, value): @@ -129,7 +129,7 @@ class TagDisplay(object): p = min(math.floor(math.log(abs(v), 2)/10.0), pow(2, len(si))) d = v / pow(2, 10*p) u = si[int(p-1)] - value = "%.1f%si"%(d, u) + value = u"%.1f%si"%(d, u) return value def type_second(self, value): @@ -137,12 +137,12 @@ class TagDisplay(object): if value.isdecimal(): v = long(value) if v < 60: - return "%ss"%value + return u"%ss"%value elif v < 3600: - return "%dm%ds"%(v/60, v%60) + return u"%dm%ds"%(v/60, v%60) elif v < 86400: - return "%dh%dm%ds"%(v/3600, v/60%60, v%60) + return u"%dh%dm%ds"%(v/3600, v/60%60, v%60) else: - return "%dd%dh%dm%ds"%(v/86400, v/3600%24, v/60%60, v%60) + return u"%dd%dh%dm%ds"%(v/86400, v/3600%24, v/60%60, v%60) return value