1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-11 16:36:14 +01:00

Fix listing of projects and packages with unicode name

This fails with UnicodeEncodeError on non unicode terminal, what makes
it impossible to list project on current OBS.
This commit is contained in:
Michal Čihař 2011-01-05 10:11:55 +01:00
parent 562c92d0d7
commit ae13273045

View File

@ -347,7 +347,11 @@ class Osc(cmdln.Cmdln):
# list sources
elif not opts.binaries:
if not args:
print '\n'.join(meta_get_project_list(apiurl, opts.deleted))
for prj in meta_get_project_list(apiurl, opts.deleted):
try:
print prj
except UnicodeEncodeError:
print prj.encode('unicode_escape')
elif len(args) == 1:
if opts.verbose:
@ -355,8 +359,11 @@ class Osc(cmdln.Cmdln):
print >>sys.stderr, 'Sorry, the --verbose option is not implemented for projects.'
if opts.expand:
raise oscerr.WrongOptions('Sorry, the --expand option is not implemented for projects.')
print '\n'.join(meta_get_packagelist(apiurl, project, opts.deleted))
for pkg in meta_get_packagelist(apiurl, project, opts.deleted):
try:
print pkg
except UnicodeEncodeError:
print pkg.encode('unicode_escape')
elif len(args) == 2 or len(args) == 3:
link_seen = False