]> git.ozlabs.org Git - patchwork/commitdiff
pwclient: fallback to patch_get_by_hash
authorJeremy Kerr <jk@ozlabs.org>
Tue, 24 Nov 2009 22:19:29 +0000 (09:19 +1100)
committerJeremy Kerr <jk@ozlabs.org>
Tue, 24 Nov 2009 22:19:29 +0000 (09:19 +1100)
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>
apps/patchwork/bin/pwclient

index 75fc6ff9d54cf9af62841a2dcb6dbf9b23f4a151..b0bd1d175b8105464b42951ad40c9a8db1abedfa 100755 (executable)
@@ -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