

def _cleanup_old_file(self, gcs_file):
    'Clean up the old version of a file.\n\n    The old version may or may not be finalized yet. Either way,\n    when user tries to create a file that already exists, we delete the\n    old version first.\n\n    Args:\n      gcs_file: an instance of _AE_GCSFileInfo_.\n    '
    if gcs_file:
        if gcs_file.finalized:
            blobkey = gcs_file.key().name()
            self.blob_storage.DeleteBlob(blobkey)
        else:
            db.delete(_AE_GCSPartialFile_.all().ancestor(gcs_file))
        gcs_file.delete()

dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/cloudstorage/cloudstorage_stub.py CloudStorageStub._cleanup_old_file/original