minor refactoring and trivial bug fix

This commit is contained in:
Bernardo Damele 2013-02-06 17:45:25 +00:00
parent e439c3d3f5
commit 477c66ac4b

View File

@ -90,22 +90,22 @@ class Dump(object):
def string(self, header, data, content_type=None, sort=True):
kb.stickyLevel = None
if hasattr(conf, "api"):
self._write(data, content_type=content_type)
return
if isListLike(data):
self.lister(header, data, sort)
self.lister(header, data, content_type, sort)
elif data is not None:
_ = getUnicode(data)
if _ and _[-1] == '\n':
_ = _[:-1]
if hasattr(conf, "api"):
self._write(data, content_type=content_type)
elif "\n" in _:
if "\n" in _:
self._write("%s:\n---\n%s\n---" % (header, _))
else:
self._write("%s: %s" % (header, ("'%s'" % _) if isinstance(data, basestring) else _))
elif hasattr(conf, "api"):
self._write(data, content_type=content_type)
else:
self._write("%s:\tNone" % header)