From 508b685c70f648f100dc3230d3105bd1ca95977d Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Mon, 15 Jun 2015 16:12:21 -0400 Subject: [PATCH] fix common API scripts so they dont fail when response has no url param --- lib/tool_shed/scripts/api/common.py | 6 ++++-- scripts/api/common.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/tool_shed/scripts/api/common.py b/lib/tool_shed/scripts/api/common.py index 13ea5847599..ef8651bcc06 100644 --- a/lib/tool_shed/scripts/api/common.py +++ b/lib/tool_shed/scripts/api/common.py @@ -94,8 +94,10 @@ def display( url, api_key=None, return_formatted=True ): print 'Collection Members' print '------------------' for n, i in enumerate(r): - # All collection members should have a name and url in the response. - print '#%d: %s' % (n+1, i.pop( 'url' ) ) + # All collection members should have a name in the response. + # url is optional + if 'url' in i: + print '#%d: %s' % (n+1, i.pop( 'url' ) ) if 'name' in i: print ' name: %s' % i.pop( 'name' ) for k, v in i.items(): diff --git a/scripts/api/common.py b/scripts/api/common.py index d81c351a5c2..d1a58b50d77 100644 --- a/scripts/api/common.py +++ b/scripts/api/common.py @@ -89,8 +89,10 @@ def display( api_key, url, return_formatted=True ): print 'Collection Members' print '------------------' for n, i in enumerate(r): - # All collection members should have a name and url in the response. - print '#%d: %s' % (n+1, i.pop( 'url' ) ) + # All collection members should have a name in the response. + # url is optional + if 'url' in i: + print '#%d: %s' % (n+1, i.pop( 'url' ) ) if 'name' in i: print ' name: %s' % i.pop( 'name' ) for k, v in i.items():