diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2009-11-25 09:19:29 +1100 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2009-11-25 09:19:29 +1100 |
commit | 73ec099a07e095016c56e49e050e20ed7056cb35 (patch) | |
tree | 6b4fa2cab8b99d57ddc1e76f031d81cc99c708cb /apps | |
parent | f34e08f25546c6283da7d44f1485f8139efd9614 (diff) | |
download | patchwork-73ec099a07e095016c56e49e050e20ed7056cb35.tar.bz2 patchwork-73ec099a07e095016c56e49e050e20ed7056cb35.tar.xz |
pwclient: fallback to patch_get_by_hash
patch_get_by_project_hash isn't in older xmlrpc interfaces, so
fall back to patch_get_by_hash if we see an xmlrpc fault when
calling this function.
Reported-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/patchwork/bin/pwclient | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/patchwork/bin/pwclient b/apps/patchwork/bin/pwclient index 75fc6ff..b0bd1d1 100755 --- a/apps/patchwork/bin/pwclient +++ b/apps/patchwork/bin/pwclient @@ -286,7 +286,13 @@ def action_update_patch(rpc, patch_id, state = None, commit = None): sys.stderr.write("Patch not updated\n") def patch_id_from_hash(rpc, project, hash): - patch = rpc.patch_get_by_project_hash(project, hash) + try: + patch = rpc.patch_get_by_project_hash(project, hash) + except xmlrpclib.Fault: + # the server may not have the newer patch_get_by_project_hash function, + # so fall back to hash-only. + patch = rpc.patch_get_by_hash(hash) + if patch == {}: return None |