'Split the invalidation request in groups of 1000 objects'

def invalidate_objects_cf(self):

    if (not self.AWS_CLOUDFRONT_DISTRIBUTION):
        raise CommandError('An    object    invalidation    was    requested    but    the    variable    AWS_CLOUDFRONT_DISTRIBUTION    is    not    present    in    your    settings.')
    chunk = 1000
    conn = self.open_cf()
    objs = self.uploaded_files
    chunks = [objs[i:(i + chunk)] for i in range(0, len(objs), chunk)]
    for paths in chunks:
        conn.create_invalidation_request(self.AWS_CLOUDFRONT_DISTRIBUTION, paths)
