if view expects one acct peruser, dont give it multiple accounts! [#36797599]

pull/1/head
eric 2012-10-12 16:03:50 -04:00
parent dd7334b54b
commit 7d21e60984
1 changed files with 4 additions and 1 deletions

View File

@ -955,8 +955,11 @@ class PaymentManager( object ):
def retrieve_or_make_accounts(self, user, host, token=None, include_deactivated=False):
accounts = self.retrieve_accounts(user=user, host=host, include_deactivated=include_deactivated)
if len(accounts) > 0:
num_acct=len(accounts)
if num_acct == 1:
return (accounts, False)
elif num_acct > 1:
return ((accounts[num_acct-1],), False)
else:
account = self.make_account(user=user, host=host, token=token)
return ((account,), True)