changeset 3896:8dae2a288339 beta

API cli should prefer to display errors instead of responses
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 22 May 2013 23:36:59 +0200
parents e39fb661998b
children aaac3954ad4a
files rhodecode/bin/rhodecode_api.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/bin/rhodecode_api.py	Wed May 22 22:46:51 2013 +0200
+++ b/rhodecode/bin/rhodecode_api.py	Wed May 22 23:36:59 2013 +0200
@@ -105,7 +105,11 @@
     if args.format == FORMAT_PRETTY:
         print 'Calling method %s => %s' % (method, apihost)
 
-    json_data = api_call(apikey, apihost, method, **margs)['result']
+    json_resp = api_call(apikey, apihost, method, **margs)
+    if json_resp['error']:
+        json_data = json_resp['error']
+    else:
+        json_data = json_resp['result']
     if args.format == FORMAT_JSON:
         print json.dumps(json_data)
     elif args.format == FORMAT_PRETTY: