def get_account(req, response): logging.info("Searching account = %s for tenant = %s" % (req['account_no'], req['tenant_id']) ) qr = gdata.accounts(tenant_id=req['tenant_id'], account_no=req['account_no']).fetch(100) if len(qr) == 1: return qr[0] else: return None
def list_accounts(req, response): qr = gdata.accounts(tenant_id=req['tenant_id']).fetch(100) rv = {"accounts" : [] } for item in qr: a = gdata.to_dict(item) a['attributes'] = json.loads(a['attributes'],parse_float=Decimal) rv['accounts'].append(a) return rv
def get_account_json(req, response): logging.info("Searching account = %s for tenant = %s" % (req['account_no'], req['tenant_id']) ) qr = gdata.accounts(tenant_id=req['tenant_id'], account_no=req['account_no']).fetch(100) rv = None if len(qr) == 1: a = gdata.to_dict(qr[0]) a['attributes'] = json.loads(a['attributes'], parse_float=Decimal) rv = a return rv