Do not overabuse len.

This commit is contained in:
Tomáš Chvátal 2014-03-04 15:35:52 +01:00
parent 41f197f53e
commit e1cd88908a

View File

@ -581,7 +581,7 @@ class StagingAPI(object):
}) })
# Print the results # Print the results
if len(working) == 0 and len(broken) == 0: if not working and not broken:
return None return None
else: else:
return [project, working, broken] return [project, working, broken]
@ -598,13 +598,13 @@ class StagingAPI(object):
return retval return retval
project, working, broken = details project, working, broken = details
if len(working) != 0: if working:
retval.append('At least following repositories is still building:') retval.append('At least following repositories is still building:')
for i in working: for i in working:
retval.append(' {}: {}'.format(i['path'], i['state'])) retval.append(' {}: {}'.format(i['path'], i['state']))
if not verbose: if not verbose:
break break
if len(broken) != 0: if broken:
retval.append('Following packages are broken:') retval.append('Following packages are broken:')
for i in broken: for i in broken:
retval.append(' {} ({}): {}'.format(i['pkg'], i['path'], retval.append(' {} ({}): {}'.format(i['pkg'], i['path'],
@ -746,7 +746,7 @@ class StagingAPI(object):
query['by_group'] = by_group query['by_group'] = by_group
if not msg: if not msg:
msg = 'Being evaluated by group "{}"'.format(by_group) msg = 'Being evaluated by group "{}"'.format(by_group)
if len(query) == 0: if not query:
raise oscerr.WrongArgs('We need a group or a project') raise oscerr.WrongArgs('We need a group or a project')
query['cmd'] = 'addreview' query['cmd'] = 'addreview'
url = self.makeurl(['request', str(request_id)], query) url = self.makeurl(['request', str(request_id)], query)