def PostContext(self): tStockAccount = StockAccount() tStockAccountManager = StockAccountManager() tStockAccountManager.LoadAccount('primary') tStockAccount = tStockAccountManager.CURRENT_STOCK t07Price = self.request.get('07price') tEocPrice = self.request.get('eocprice') if self.USER.email().lower() == '*****@*****.**': if t07Price is not None: if len(t07Price) > 0: tStockAccount.stockPrice07 = float(t07Price) if tEocPrice is not None: if len(tEocPrice) > 0: tStockAccount.stockPriceEoc = float(tEocPrice) else: return {'error': 'You bad bad boy. FBI Notified.'} tStockAccount.put() self.LOCATION = "/manage-commission" self.REDIRECT = True return {} #need to return something for processing
def PostContext(self): tStockAccount = StockAccount() tStockAccountManager = StockAccountManager() tStockAccountManager.LoadAccount('primary') tStockAccount = tStockAccountManager.CURRENT_STOCK t07Price = self.request.get('07price') tEocPrice = self.request.get('eocprice') if self.USER.email().lower() == '*****@*****.**': if t07Price is not None: if len(t07Price) > 0: tStockAccount.stockPrice07 = float(t07Price) if tEocPrice is not None: if len(tEocPrice) > 0: tStockAccount.stockPriceEoc = float(tEocPrice) else: return {'error' : 'You bad bad boy. FBI Notified.'} tStockAccount.put() self.LOCATION = "/manage-commission" self.REDIRECT = True return {} #need to return something for processing #self.redirect(tLocation)
def SetStock(self, aNewStockAmount, aGoldType): tStockAccount = StockAccount() tStockAccount = self.CURRENT_STOCK #logging.debug("{}".format(aNewStockAmount)) #logging.debug("{}".format(aGoldType)) if aGoldType == "07": tStockAccount.stockQuantity07 = tStockAccount.stockQuantity07 + aNewStockAmount elif aGoldType == "eoc": tStockAccount.stockQuantityEoc = tStockAccount.stockQuantityEoc + aNewStockAmount tKey = tStockAccount.put() self.CURRENT_STOCK = tStockAccount return tKey
def AddCommission(self, aGoldAmount, aGoldType): tStockAccount = StockAccount() tStockAccount = self.CURRENT_STOCK if aGoldType == "07": tCommission = aGoldAmount * self.CURRENT_07 / 1000000 elif aGoldType == "eoc": tCommission = aGoldAmount * self.CURRENT_EOC / 1000000 tStockAccount.stockCommission = tStockAccount.stockCommission + tCommission tKey = tStockAccount.put() self.CURRENT_STOCK = tStockAccount return tKey