def GlobalBlacklistCustomer(self, pKey):
     tCustomer = Customer()
     tCustomerHandler = CustomerHandler()
     #logging.debug("Global Blacklisting Customer: " + str(pKey))
     try:
         tCustomer = tCustomerHandler.GetCustomerByKey(pKey)
         tCustomer.customerIsGlobalBlacklisted = 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.ipIsGlobalBlacklisted = True
                 ip.put()
         return True
     except:
         return False
Esempio n. 2
0
    def GlobalBlacklistCustomer(self, pKey):
        tCustomer = Customer()
        tCustomerHandler = CustomerHandler()
        #logging.debug("Global Blacklisting Customer: " + str(pKey))
        try:
            tCustomer = tCustomerHandler.GetCustomerByKey(pKey)
            tCustomer.customerIsGlobalBlacklisted = 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.ipIsGlobalBlacklisted = True
                    ip.put()
            return True
        except:
            return False