daily pastebin goal
83%
SHARE
TWEET

Untitled

a guest Jun 19th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def to_dict(self, *args, **kwargs):
  2.         if 'bank' in args[0] and not 'bank' in self.bank.capabilities:
  3.             args[0].pop('bank')
  4.         if 'provider' in args[0]:
  5.             args[0].pop('provider')
  6.             if not 'bank' in self.bank.capabilities:
  7.                 args[0]['bank'] = {}
  8.  
  9.         data = super(Connection, self).to_dict(*args, **kwargs)
  10.         data['error_message'] = self.last_log.error_message if self.last_log else None
  11.         if 'accounts' in data:
  12.             data['balance'] = sum([acc['balance'] for acc in data['accounts']])
  13.  
  14.         if 'document' in self.bank.capabilities:
  15.             data['id_provider'] = self.id_bank
  16.         if not 'bank' in self.bank.capabilities:
  17.             data.pop('id_bank')
  18.  
  19.         self.logger.error(str(data))
  20.         return data
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Pastebin PRO 'SPRING SPECIAL'!
Get 40% OFF Pastebin PRO accounts!
 
Top