def post(self): customerID = self.get_cookie("digitATM") amount = self.get_argument("amount", "") if customerID is not None: RequestManager.withdraw(customerID, amount) self.write("<span style=\"text-align:center\">Withdrew {0} from customer ID {1}'s account. Return to <a href=\"/menu\"> the menu</a>.</span>".format(locale.currency(float(amount), grouping=True), customerID)) else: self.write("Although customer ID {0} exists, an error occurred when attempting to get the hash value for customer ID {0}.".format(customerID)) return
def post(self): customerID = self.get_argument("customerID", "") amount = self.get_argument("amount", "") jsondata = None with open("accounts.json", "r") as jsonfile: jsondata = json.load(jsonfile) customerHash = None if jsondata is not None and customerID in jsondata: customerHash = jsondata[customerID] else: self.write("Customer ID {0} is not a valid customer ID.".format(customerID)) return if customerHash is not None: RequestManager.withdraw(customerHash, amount) self.write("Deposited {0} in customer ID {1}'s account.".format(locale.currency(float(amount), grouping=True), customerID)) else: self.write("Although customer ID {0} exists, an error occurred when attempting to get the hash value for customer ID {0}.".format(customerID)) return