

def handle(self, *args, **options):
    conn = boto.connect_s3(settings.AWS_ACCESS_KEY_ID, settings.AWS_SECRET_ACCESS_KEY)
    self.bucket = conn.get_bucket(settings.AWS_BUCKET_NAME)
    self.keys = list((key.name for key in self.bucket.list()))
    self.key_chunks = []
    for i in range(0, len(self.keys), 100):
        self.key_chunks.append(self.keys[i:(i + 100)])
    for chunk in self.key_chunks:
        self.bucket.delete_keys(chunk)
    logger.info(('unpublish completed, %d deleted files' % len(self.keys)))

dataset/ETHPy150Open datadesk/django-bakery/bakery/management/commands/unpublish.py Command.handle/original