def PostContext(self): tContext = {} tPriceDictionary = _data.PriceContainer.GetBasePriceDictionaryWithoutZeros( ) tPriceList = [] tSortedPriceKeys = sorted(tPriceDictionary.keys()) for tCurrentKey in tSortedPriceKeys: if (len(tCurrentKey) == 2): tKey = "000" + tCurrentKey elif (len(tCurrentKey) == 3): tKey = "00" + tCurrentKey elif (len(tCurrentKey) == 4): tKey = "0" + tCurrentKey else: tKey = tCurrentKey #logging.debug('tCurrentKey ' + tCurrentKey) tTuple = (tKey, self.request.get(tCurrentKey)) tPriceList.append(tTuple) #logging.debug('Price List construction complete') tCurrentPrice = Price() typeOfGold = self.GOLDTYPE if typeOfGold is 'regular': tCurrentPrice.priceType = 'regular' self.LOCATION = '/price' tContext['post_location'] = '/price' elif typeOfGold is '07': tCurrentPrice.priceType = '07' self.LOCATION = '/price07' tContext['post_location'] = '/price07' #logging.debug(tPriceList) for tVolume, tNewPrice in tPriceList: #logging.debug("tVolume " + tVolume) #logging.debug("tNewPrice " + tNewPrice) tPropertyName = "price" + tVolume if tPropertyName in tCurrentPrice.properties().keys(): try: tCurrentPrice.__setattr__(tPropertyName, float(tNewPrice)) except: tCurrentPrice.__setattr__(tPropertyName, tNewPrice) #logging.debug("New price object constructed") #for tProperty in tCurrentPrice.properties().keys(): # logging.debug("Property " + tProperty + " is " + str(tCurrentPrice.properties()[tProperty])) tCurrentPrice.priceCreator = str(self.GetUser().email()) #typeOfGold = self.request.get('goldtype') tCurrentPrice.put() self.REDIRECT = True return tContext
def PostContext(self): tContext = {} tPriceDictionary = _data.PriceContainer.GetBasePriceDictionaryWithoutZeros() tPriceList = [] tSortedPriceKeys = sorted(tPriceDictionary.keys()) for tCurrentKey in tSortedPriceKeys: if len(tCurrentKey) == 2: tKey = "000" + tCurrentKey elif len(tCurrentKey) == 3: tKey = "00" + tCurrentKey elif len(tCurrentKey) == 4: tKey = "0" + tCurrentKey else: tKey = tCurrentKey # logging.debug('tCurrentKey ' + tCurrentKey) tTuple = (tKey, self.request.get(tCurrentKey)) tPriceList.append(tTuple) # logging.debug('Price List construction complete') tCurrentPrice = Price() typeOfGold = self.GOLDTYPE if typeOfGold is "regular": tCurrentPrice.priceType = "regular" self.LOCATION = "/price" tContext["post_location"] = "/price" elif typeOfGold is "07": tCurrentPrice.priceType = "07" self.LOCATION = "/price07" tContext["post_location"] = "/price07" # logging.debug(tPriceList) for tVolume, tNewPrice in tPriceList: # logging.debug("tVolume " + tVolume) # logging.debug("tNewPrice " + tNewPrice) tPropertyName = "price" + tVolume if tPropertyName in tCurrentPrice.properties().keys(): try: tCurrentPrice.__setattr__(tPropertyName, float(tNewPrice)) except: tCurrentPrice.__setattr__(tPropertyName, tNewPrice) # logging.debug("New price object constructed") # for tProperty in tCurrentPrice.properties().keys(): # logging.debug("Property " + tProperty + " is " + str(tCurrentPrice.properties()[tProperty])) tCurrentPrice.priceCreator = str(self.GetUser().email()) # typeOfGold = self.request.get('goldtype') tCurrentPrice.put() self.REDIRECT = True return tContext