def __path_prefix(self, folder): """ Path prefix to be used when archiving any items from the given folder. Expects the folder to be located under the base folder path and the returned path prefix does not include the base folder information. This makes sure we include just the base folder's content in the archive, and not the base folder itself. """ path_parts = path_iter(folder) _skip_expected(path_parts, self.__base_folder_parts) result = "/".join(path_parts) if result: result += "/" return result
def __init__(self, zip_file, folder): self.__zip_file = zip_file self.__base_folder_parts = list(path_iter(folder))