當前位置: 首頁>>代碼示例>>Python>>正文


Python Order.fetch方法代碼示例

本文整理匯總了Python中models.order.Order.fetch方法的典型用法代碼示例。如果您正苦於以下問題:Python Order.fetch方法的具體用法?Python Order.fetch怎麽用?Python Order.fetch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.order.Order的用法示例。


在下文中一共展示了Order.fetch方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get

# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import fetch [as 別名]
    def get(self):
        tCode = re.sub(r"\W", "", self.request.get("code")).lower()
        tOrderId = self.request.get("id")

        logging.debug(tCode)

        tOrder = Order()
        # tOrder.orderVerificationCode
        tOrderQuery = Order().all()
        tOrderQuery.filter("orderVerificationCode", tCode)

        if tOrderId:
            tOrderQuery.filter("orderTransactionId", tOrderId)

        tOrderList = tOrderQuery.fetch(limit=1)

        logging.debug(str(tOrderList))

        tSave = False
        if tOrderList is not None:
            try:
                tOrder = tOrderList[0]
                tOrder.orderIsVerified = True
                tSave = True
            except:
                if len(tOrderList) > 0:
                    tOrder = tOrderList
                    tOrder.orderIsVerified = True
                    tSave = True

            if tSave:
                try:
                    tOrder.put()
                except:
                    pass
開發者ID:Kenneth-Posey,項目名稱:kens-old-projects,代碼行數:37,代碼來源:verifycode.py

示例2: GetContext

# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import fetch [as 別名]
 def GetContext(self):
     tOrder = {}
     tContext = {}
     
     tOrderQuery = Order().all()
     tOrderQuery.filter("orderIsGenerated", True)
     tOrderQuery.order("-orderCreated")
     tOrderList = tOrderQuery.fetch(limit=30)
     
     tContext['orders'] = tOrderList
     
     return tContext
開發者ID:Kenneth-Posey,項目名稱:kens-old-projects,代碼行數:14,代碼來源:ordergenerator.py

示例3: post

# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import fetch [as 別名]
 def post(self):
     tIpLookup = IpLookup()
     tIpStore = IpInfo()
     tIp = str(self.request.get('ip'))
     tTransactionId = str(self.request.get('transid'))
     
     tIpInfo = {}
     #logging.debug("Scraping Ip: " + tIp)
     
     if (tIp != None and len(tIp) > 0):
         tIpInfo = tIpLookup.IpInfoScraper(tIp)
     else:
         tIpInfo = {}
         tIpInfo['country'] = ""
         tIpInfo['host'] = ""
         tIpInfo['state'] = ""
         tIpInfo['isp'] = ""
         tIpInfo['proxy'] = ""
         tIpInfo['type'] = ""
     
     tIpStore.ip = tIp
     tIpStore.ipCountry = tIpInfo['country']
     tIpStore.ipHost = tIpInfo['host']
     tIpStore.ipState = tIpInfo['state']
     tIpStore.ipIsp = tIpInfo['isp']
     tIpStore.ipProxy = tIpInfo['proxy']
     tIpStore.ipType = tIpInfo['type']
     tIpStore.ipOrder = tTransactionId
     tIpKey = tIpStore.put()
     
     #logging.debug("Stored IP: " + tIp + " at Key " + str(tIpKey))
     
     tOrder = Order()
     tOrderQuery = Order().all()
     #logging.debug("Transaction Id: " + tTransactionId)
     tOrderQuery.filter("orderTransactionId", tTransactionId)
     tOrder = tOrderQuery.fetch(1)[0]
     
     tMobilePhone = tOrder.orderMobileNumber
     tCustomerKey = tOrder.orderCustomer
     tOrderKey = str(tOrder.key())
     #logging.debug("IP Address Mobile Number " + str(tMobilePhone))
     if (tMobilePhone != None and len(tMobilePhone) > 0):
         taskqueue.add(url="/phonelookup", countdown = 1, params = { "order": tOrderKey, 
                                                                     "customer": tCustomerKey,
                                                                     "ipcountry": tIpStore.ipCountry } )
開發者ID:Kenneth-Posey,項目名稱:kens-old-projects,代碼行數:48,代碼來源:iplookup.py

示例4: PostContext

# 需要導入模塊: from models.order import Order [as 別名]
# 或者: from models.order.Order import fetch [as 別名]

#.........這裏部分代碼省略.........
        #logging.debug(str(tOrder))
        
        tAvailableEligibility = ["Ineligible","Partially Eligible - INR Only","Eligible"]
        tOrder['protection_eligibility'] = random.choice(tAvailableEligibility)
        
        tAvailableStatus = ["verified","unverified"]
        tOrder['payer_status'] = random.choice(tAvailableStatus)
        
        if(tType == "random" or tType == "me"):                    
            tOrder['mc_gross'] = tRandomPrice
            tOrder['payment_gross'] = tRandomPrice
            tOrder['txn_type'] = 'web_accept'
            tOrder['discount'] = '0.0'
            tOrder['handling_amount'] = '0.0'
            tOrder['insurance_amount'] = '0.0'
            tOrder['item_number'] = '1'
            tOrder['mc_fee'] = '0.0'
            tOrder['COUNTRYCODE'] = 'US'
            tOrder['address_country'] = 'United States'
            tOrder['payment_fee'] = '0.0'
            tOrder['quantity'] = "1"
            tOrder['shipping'] = "0.0"
            tOrder['shipping_discount'] = "0.0"
            tOrder['shipping_method'] = "Default"
            tOrder['tax'] = "0.0"
            
            tOrder['item_name'] = tRandomAmount.upper() + "Transfer Code"
            
            tReferralCodes = ["", "69a8e184"]
            tRandomReferral = random.choice(tReferralCodes)
            
            tPromoCodes = ["SMELITE10"]
            tRandomPromoCode = random.choice(tPromoCodes)   
            
            tOrder['option_name1'] = 'Test Order Name'      #name    
            tOrder['option_name4'] = 'RS Test Name'         #rs name 
            tOrder['option_name5'] = tRandomReferral        #referral
            tOrder['option_name5'] = tRandomPromoCode       #promocode formerly option 6
            tOrder['option_name7'] = tRandomAmount          #gold amount
            
        #logging.debug(str(tOrder))
        if(tType == "random" or tType == "viprandom"):
            tRandomEmail = 'sm-test-email-' + "".join(tRandomNumberList) + "@smokinmils.com"
            tOrder['payer_email'] = tRandomEmail
            tOrder['payer_id'] = "".join(tRandomNumberList) + "-testid"
            tOrder['txn_id'] = "".join(tRandomNumberList)        
            tOrder['custom'] = '65.91.31.0'
            tOrder['option_name2'] = tRandomEmail           #email
            tOrder['option_name3'] = '310-274-7777'         #number
            tOrder['transaction_subject'] = '65.91.31.0'
        #logging.debug(str(tOrder))
        if(tType == "me" or tType == "vipme"):
            tOrder['custom'] = '75.138.80.254'
            tOrder['payer_email'] = '[email protected]'
            tOrder['payer_id'] = 'FE6TJMYCTZ9CA'
            tOrder['txn_id'] = "".join(tRandomNumberList)        
            tOrder['option_name2'] = '[email protected]'
            tOrder['option_name3'] = '678-499-6457'   
            tOrder['transaction_subject'] = '75.138.80.254'
        #logging.debug(str(tOrder))
        if(tType == "viprandom" or tType == "vipme"):
            tOrder['payment_gross'] = "8.99"
            tOrder['transaction_subject'] = "VIP Membership"
            tOrder['item_name'] = "VIP Membership"
            tOrder['item_number'] = "VIP"
            tOrder['mc_gross'] = "8.99"
            tOrder['txn_type'] = "subscr_payment"
            tOrder['subscr_id'] = "".join(tRandomNumberList)
        #logging.debug(str(tOrder))
        tOrder['payment_status'] = 'Completed'
        tOrder['payment_type'] = 'Instant'
        tOrder['last_name'] = "Pleco"
        tOrder['first_name'] = "Kort"
        
        tOrder['fake'] = 'True'        
        #logging.debug("Last call: " + str(tOrder))
        tPayloadEncoded = urllib.urlencode(tOrder)

        #logging.debug("Encoded: " + str(tPayloadEncoded))

        tUrl = "http://smokin-goldshop.appspot.com/paypalipn"
        #logging.debug("Url: " + str(tUrl))
        
        request_cookies = mechanize.CookieJar()
        request_opener = mechanize.build_opener(mechanize.HTTPCookieProcessor(request_cookies))
        request_opener.addheaders = [('Content-Type', 'application/x-www-form-urlencoded')]
        
        mechanize.install_opener(request_opener)
        tResponse = mechanize.urlopen(url = tUrl, timeout = 25.0, data = tPayloadEncoded)
        
        
        tOrderQuery = Order().all()
        tOrderQuery.filter("orderIsGenerated", True)
        tOrderQuery.order("-orderCreated")
        tOrderList = tOrderQuery.fetch(limit=30)
        
        tContext['orders'] = tOrderList        
        
        #logging.debug("Response: " + str(tResponse))
        return tContext
開發者ID:Kenneth-Posey,項目名稱:kens-old-projects,代碼行數:104,代碼來源:ordergenerator.py


注:本文中的models.order.Order.fetch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。