1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-02 17:56:15 +01:00

sort request lists by id

This commit is contained in:
Ludwig Nussel 2011-02-09 14:57:10 +01:00
parent 09cee2a9f0
commit 69458ca8c4
2 changed files with 6 additions and 3 deletions

View File

@ -5044,7 +5044,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
what = {'project': ''} what = {'project': ''}
elif type in args_sr: elif type in args_sr:
requests = get_request_list(apiurl, req_who=user, exclude_target_projects=exclude_projects) requests = get_request_list(apiurl, req_who=user, exclude_target_projects=exclude_projects)
for r in requests: for r in requests_sort(requests):
print r.list_view(), '\n' print r.list_view(), '\n'
return return
elif not type in args_pkg: elif not type in args_pkg:
@ -5075,7 +5075,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
r = Request() r = Request()
r.read(node) r.read(node)
requests.append(r) requests.append(r)
for r in requests: for r in requests_sort(requests):
print r.list_view(), '\n' print r.list_view(), '\n'
return return
except urllib2.HTTPError, e: except urllib2.HTTPError, e:
@ -5108,7 +5108,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if list_requests: if list_requests:
# old style, only for OBS 2.1 and before. Should not be used, since it is slow and incomplete # old style, only for OBS 2.1 and before. Should not be used, since it is slow and incomplete
requests = get_user_projpkgs_request_list(apiurl, user, projpkgs=request_todo) requests = get_user_projpkgs_request_list(apiurl, user, projpkgs=request_todo)
for r in requests: for r in requests_sort(requests):
print r.list_view(), '\n' print r.list_view(), '\n'
else: else:
for i in sorted(roles.keys()): for i in sorted(roles.keys()):

View File

@ -6122,4 +6122,7 @@ def filter_role(meta, user, role):
for node in delete: for node in delete:
root.remove(node) root.remove(node)
def requests_sort(requests):
return sorted(requests, cmp=lambda a,b: cmp(int(a.reqid), int(b.reqid)))
# vim: sw=4 et # vim: sw=4 et