def myinfo(self): user = api.user.get_current() fullname = user.getProperty('fullname') if type(fullname).__name__ == 'object': fullname = None portrait = user.portal_memberdata.getPersonalPortrait() #import pdb;pdb.set_trace() info = {'name': fullname, 'clubs': ['BB', 'CC', 'DD'], 'portrait': portrait} if self.megabankisinstalled: from hejasverige.megabank.bank import Bank pid = api.user.get_current().getProperty('personal_id') # if field is not defined as a personal property it becomes an object and the bank fails to load if type(pid).__name__ == 'object': info['balance'] = 'error' info['amount_pending'] = 'error' else: import locale locale.setlocale(locale.LC_ALL, 'sv_SE.utf-8') try: accountinfo = Bank().getAccount(personalid=pid, context=self) info['balance'] = locale.currency(accountinfo.get('Balance', None), grouping=True) info['amount_pending'] = locale.currency(accountinfo.get('AmountPending', None), grouping=True) except: info['balance'] = 'conerror' info['amount_pending'] = 'conerror' #import pdb; pdb.set_trace() return info
def myinfo(self): info = {} pid = api.user.get_current().getProperty('personal_id') #import pdb; pdb.set_trace() try: accountinfo = Bank().getAccount(personalid=pid, context=self) info['pid'] = pid info['balance'] = accountinfo.get('Balance', None) info['amount_pending'] = accountinfo.get('AmountPending', None) info['amount_to_pay'] = self.session()[SessionKeys.selected_amount] except: pass return info