コード例 #1
0
 def PaBlacklistCustomer(self, pKey):
     #logging.debug("PA Blacklisting Customer: " + str(pKey))
     tCustomer = Customer()
     tCustomerHandler = CustomerHandler()
     try:
         tCustomer = tCustomerHandler.GetCustomerByKey(pKey)
         tCustomer.customerIsPaBlacklisted = True
         tCustomer.put()
         
         tIpList = tCustomer.customerIpAddresses
         #logging.debug("Customer IPs: " + str(tIpList))
         tUniqueIps = set(tIpList)
         tUniqueIps = list(tUniqueIps)
         ip = IpInfo()
         for tIp in tUniqueIps:
             #logging.debug("Blacklisting IP: " + str(tIp))
             tIps = IpInfo().all()
             tIps.filter("ip", tIp)
             tIpModels = tIps.fetch(100)
             for ip in tIpModels:
                 ip.ipIsPaBlacklisted = True
                 ip.put()
         return True
     except:
         return False
コード例 #2
0
    def PaBlacklistCustomer(self, pKey):
        #logging.debug("PA Blacklisting Customer: " + str(pKey))
        tCustomer = Customer()
        tCustomerHandler = CustomerHandler()
        try:
            tCustomer = tCustomerHandler.GetCustomerByKey(pKey)
            tCustomer.customerIsPaBlacklisted = True
            tCustomer.put()

            tIpList = tCustomer.customerIpAddresses
            #logging.debug("Customer IPs: " + str(tIpList))
            tUniqueIps = set(tIpList)
            tUniqueIps = list(tUniqueIps)
            ip = IpInfo()
            for tIp in tUniqueIps:
                #logging.debug("Blacklisting IP: " + str(tIp))
                tIps = IpInfo().all()
                tIps.filter("ip", tIp)
                tIpModels = tIps.fetch(100)
                for ip in tIpModels:
                    ip.ipIsPaBlacklisted = True
                    ip.put()
            return True
        except:
            return False