def upload(self, local_path):
        """
        Upload an encoded file to remote storage and remove the
        local file.
        """
        new_hash = self.generate_content_hash(local_path)
        if new_hash != self.content_hash:
            self.unlink()
            self.content_hash = new_hash

        if not self.exists():
            try:
                logger.info("Uploading %s to %s" % (local_path, self.remote_path))
                self.get_storage().save(self.remote_path, open(local_path))
            except Exception as e:
                logger.error("Error saving '%s' to remote storage: %s" % (local_path, e))
                raise
        try:
            os.unlink(local_path)
        except __HOLE__ as e:
            logger.error("Error removing file '%s': %s" % (local_path, e))
dataset/ETHPy150Open jbittel/django-multimedia/multimedia/models.py/RemoteStorage.upload