def get(self): page = Page.CALC parameters = getPageDict(page) parameters['User'] = "******" % (getCurrentUser(), getGroup()) try: c = calc() logging.debug(80*"*") logging.debug("loans =") logging.debug(c['loans']) logging.debug(80*"*") logging.debug("bids =") logging.debug(c['bids']) if 'loans' in c and 'bids' in c: parameters['loans'] = c['loans'] parameters['bids'] = c['bids'] for i in range(1, len(c['bids'])): b = Bid.get_by_key_name(key_names = c['bids'][i][0]['bid']) for j in range(len(c['bids'][i])): if 'key' in c['bids'][i][j]: l = loan.getLoan(c['bids'][i][j]['key']) if (l.curr_upb >= long(float(c['bids'][i][j]['val']))): l.curr_upb -= long(float(c['bids'][i][j]['val'])) l.put() else: raise CalcError("ERROR: At discount Bit %s to Loan %s curr_upb %s" % (str(c['bids'][i][0]['bid']), str(l.collateral_key), str(l.curr_upb))) b.status = 'Accepted' b.put() self.response.out.write(template.render("templates/results.html", parameters)) except: g = getGroup() if g == 'Demo': c = Demo_Param_Calc() parameters['loans'] = c['loans'] parameters['bids'] = c['bids'] self.response.out.write(template.render( "templates/results.html", parameters)) else: self.response.out.write(template.render("templates/oops.html", []))
def get(self): page = Page.MYBIDS parameters = getPageDict(page) parameters['User'] = "******" % (getCurrentUser(), getGroup()) self.response.out.write(template.render("templates/mybids.html", parameters))