def destroy_index(self): """ Destroy the index. Don't use this DocSearch object anymore after this call. Next instantiation of a DocSearch will rebuild the whole index """ logger.info("Destroying the index ...") rm_rf(self.indexdir) logger.info("Done")
def destroy_index(self): """ Destroy the index. Don't use this DocSearch object anymore after this call. Next instantiation of a DocSearch will rebuild the whole index """ print "Destroying the index ..." rm_rf(self.indexdir) print "Done"
def destroy(self): """ Delete the document. The *whole* document. There will be no survivors. """ logger.info("Destroying doc: %s" % self.path) rm_rf(self.path) logger.info("Done") self.drop_cache()
def destroy(self): """ Delete the document. The *whole* document. There will be no survivors. """ print "Destroying doc: %s" % self.path rm_rf(self.path) print "Done" self.drop_cache()
def cleanup_rootdir(self, progress_cb=dummy_progress_cb): must_clean_cbs = [ is_dir_empty, img.is_tmp_file, ] progress_cb(0, 1, self.INDEX_STEP_CLEANING) for filepath in self.__browse_dir(self.rootdir): must_clean = False for must_clean_cb in must_clean_cbs: if must_clean_cb(filepath): must_clean = True break if must_clean: print "Cleanup: Removing '%s'" % filepath rm_rf(filepath) progress_cb(1, 1, self.INDEX_STEP_CLEANING)
def cleanup_rootdir(self, progress_cb=dummy_progress_cb): """ Remove all the crap from the work dir (temporary files, empty directories, etc) """ progress_cb(0, 1, self.INDEX_STEP_CLEANING) for filename in os.listdir(self.rootdir): filepath = os.path.join(self.rootdir, filename) if self.__must_clean(filepath): logger.info("Cleanup: Removing '%s'" % filepath) rm_rf(filepath) elif os.path.isdir(filepath): # we only want to go one subdirectory deep, no more for subfilename in os.listdir(filepath): subfilepath = os.path.join(filepath, subfilename) if self.__must_clean(subfilepath): logger.info("Cleanup: Removing '%s'" % subfilepath) rm_rf(subfilepath) progress_cb(1, 1, self.INDEX_STEP_CLEANING)