traffic_log/models.py
def _expunge_expired_spot_copies(self, random_spot_copies):
        """Check to see if any of the cached spot copies have expired.
        
        if so, expunge them and save the spot with a new list.
        """
        q = SpotCopy.all().filter("spot =", self)

        # GAE sets a maximum length on lists given to the "in" filter
        # as below, so split "random_spot_copies" into sublists whose
        # length is this maximum, then operate on the sublists.  Note
        # that we send a copy of "random_spot_copies" to "split_list"
        # because we will be mutating random_spot_copies as we work.
        for sublist in split_list(random_spot_copies[:]):
            one_expired = False
            q = q.filter("__key__ in", sublist)
   
            expired_spot_copy_keys = []
            for copy in q:
                if copy.expire_on and copy.expire_on <= datetime.datetime.now():
                    expired_spot_copy_keys.append(copy.key())
        
            for expired_key in expired_spot_copy_keys:
                for k in random_spot_copies:
                    one_expired = True
                    if str(k) == str(expired_key) and k in random_spot_copies:
                        random_spot_copies.remove(k)
            if one_expired:
                # only save if we have to since expunging will be rare
                self.random_spot_copies = random_spot_copies
                AutoRetry(self).save()
Check to see if any of the cached spot copies have expired.
        
        if so, expunge them and save the spot with a new list.
        
Check to see if any of the cached spot copies have expired.
if so, expunge them and save the spot with a new list.
Check to see if any of the cached spot copies have expired . if so expunge them and save the spot with a new list .
def _expunge_expired_spot_copies(self, random_spot_copies):
        q = SpotCopy.all().filter("spot =", self)
        for sublist in split_list(random_spot_copies[:]):
            one_expired = False
            q = q.filter("__key__ in", sublist)
            expired_spot_copy_keys = []
            for copy in q:
                if copy.expire_on and copy.expire_on <= datetime.datetime.now():
                    expired_spot_copy_keys.append(copy.key())
            for expired_key in expired_spot_copy_keys:
                for k in random_spot_copies:
                    one_expired = True
                    if str(k) == str(expired_key) and k in random_spot_copies:
                        random_spot_copies.remove(k)
            if one_expired:
                self.random_spot_copies = random_spot_copies
                AutoRetry(self).save()
def _expunge_expired_spot_copies ( self , random_spot_copies ) : q = SpotCopy . all ( ) . filter ( "spot =" , self ) for sublist in split_list ( random_spot_copies [ : ] ) : one_expired = False q = q . filter ( "__key__ in" , sublist ) expired_spot_copy_keys = [ ] for copy in q : if copy . expire_on and copy . expire_on <= datetime . datetime . now ( ) : expired_spot_copy_keys . append ( copy . key ( ) ) for expired_key in expired_spot_copy_keys : for k in random_spot_copies : one_expired = True if str ( k ) == str ( expired_key ) and k in random_spot_copies : random_spot_copies . remove ( k ) if one_expired : self . random_spot_copies = random_spot_copies AutoRetry ( self ) . save ( )
Check to see if any of the cached spot copies have expired.
Check to see if any of the cached spot copies have expired .
"""Check to see if any of the cached spot copies have expired.
        
        if so, expunge them and save the spot with a new list.
        """ # GAE sets a maximum length on lists given to the "in" filter # as below, so split "random_spot_copies" into sublists whose # length is this maximum, then operate on the sublists.  Note # that we send a copy of "random_spot_copies" to "split_list" # because we will be mutating random_spot_copies as we work. # only save if we have to since expunging will be rare
self
random_spot_copies