diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index 81e5d1f8..46db7c79 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -491,7 +491,7 @@ Usage: info ... import os.path metadata, files = pisi.api.info(arg) - ctx.ui.info(str(metadata.package)) + ctx.ui.info(unicode(metadata.package)) if self.options.files or self.options.files_path: if files: ctx.ui.info(_('\nFiles:')) diff --git a/pisi/specfile.py b/pisi/specfile.py index 3836bba0..4edbd5c6 100644 --- a/pisi/specfile.py +++ b/pisi/specfile.py @@ -369,7 +369,7 @@ class PackageInfo: self.name, self.version, self.release, self.build) s += _('\nSummary: ') + self.summary s += _('\nDescription: ') + self.description - s += _('\nComponent: ') + str(self.partof) + s += _('\nComponent: ') + unicode(self.partof) s += _('\nProvides: ') for x in self.providesComar: s += x.om diff --git a/pisi/xmlfile.py b/pisi/xmlfile.py index 0cb07417..9ea8b590 100644 --- a/pisi/xmlfile.py +++ b/pisi/xmlfile.py @@ -386,6 +386,7 @@ class autoxml(type): def encode(xml, node, value, errs): """encode given value inside DOM node""" if value: + #FIXME: unicode() here? writetext(xml, node, token, str(value)) else: if req == mandatory: @@ -393,7 +394,7 @@ class autoxml(type): def format(value, errs): """format value for pretty printing""" - return str(value) + return unicode(value) return initialize, decode, encode, format diff --git a/tools/repostats.py b/tools/repostats.py index 642e604c..039d77bd 100755 --- a/tools/repostats.py +++ b/tools/repostats.py @@ -151,12 +151,14 @@ valid_filetypes = [ ] def printu(obj): - if isinstance(obj, unicode): + """smart print command which handles unicode strings and objects which + return unicode __str__'s, a common case in our implementation""" + if isinstance(obj, str): + print obj + elif isinstance(obj, unicode): print obj.encode('utf-8') - elif isinstance(obj, str): - print obj.decode('utf-8') else: - print str(obj) + print unicode(obj).encode('utf-8') # this is printu! def valuesort(x, y): if x[1] > y[1]: