jp (base, blog, output(std)): fixed bad unicode handling in stdout, use of jp.disp instead of simple print

This commit is contained in:
Goffi 2017-02-21 21:01:40 +01:00
commit 8155bc3ee8

View file

@ -277,7 +277,7 @@ class Get(base.CommandBase):
k_fmt_e = A.RESET,
sep = u'\n' if 'content' in k else u'')
value = k_cb[k](item, keys) if k in k_cb else item[k]
print header + value
self.disp(header + value)
# we want a separation line after each item but the last one
if idx < len(items)-1:
print(u'')
@ -332,7 +332,7 @@ class Get(base.CommandBase):
if (title or tags) and content:
print("")
if content:
print content
self.disp(content)
print(u'\n' + sep + '\n')
@ -812,16 +812,16 @@ class Import(base.CommandAnswering):
if getattr(self.args, name):
self.parser.error(_(u"{name} argument can't be used without location argument").format(name=name))
if self.args.importer is None:
print u'\n'.join([u'{}: {}'.format(name, desc) for name, desc in self.host.bridge.blogImportList()])
self.disp(u'\n'.join([u'{}: {}'.format(name, desc) for name, desc in self.host.bridge.blogImportList()]))
else:
try:
short_desc, long_desc = self.host.bridge.blogImportDesc(self.args.importer)
except Exception as e:
msg = [l for l in unicode(e).split('\n') if l][-1] # we only keep the last line
print msg
self.disp(msg)
self.host.quit(1)
else:
print u"{name}: {short_desc}\n\n{long_desc}".format(name=self.args.importer, short_desc=short_desc, long_desc=long_desc)
self.disp(u"{name}: {short_desc}\n\n{long_desc}".format(name=self.args.importer, short_desc=short_desc, long_desc=long_desc))
self.host.quit()
else:
# we have a location, an import is requested