Commit 8fd7e228 by Jim Abramson

Merge pull request #305 from edx/jsa/xcom-471

avoid exception when `paypal_profile list` has no results
parents d1f1aa6b f5dab6a2
...@@ -106,7 +106,13 @@ class Command(BaseCommand): ...@@ -106,7 +106,13 @@ class Command(BaseCommand):
def handle_list(self, args): # pylint: disable=unused-argument def handle_list(self, args): # pylint: disable=unused-argument
"""Wrapper for paypalrestsdk List operation.""" """Wrapper for paypalrestsdk List operation."""
profiles = WebProfile.all() profiles = WebProfile.all()
self.print_json([profile.to_dict() for profile in profiles]) result = []
try:
result = [profile.to_dict() for profile in profiles]
except KeyError:
# weird internal paypal sdk behavior; it means the result was empty.
pass
self.print_json(result)
def handle_create(self, args): def handle_create(self, args):
"""Wrapper for paypalrestsdk Create operation.""" """Wrapper for paypalrestsdk Create operation."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment