'Recursively load repository folder contents and append them to a list. Similar to os.walk but via /repository/open_folder.'

def get_repository_file_list(self, repository, base_path, current_path=None):

    if (current_path is None):
        request_param_path = base_path
    else:
        request_param_path = os.path.join(base_path, current_path)
    params = dict(folder_path=request_param_path, repository_id=self.security.encode_id(repository.id))
    url = '/repository/open_folder'
    self.visit_url(url, params=params)
    file_list = loads(self.last_page())
    returned_file_list = []
    if (current_path is not None):
        returned_file_list.append(current_path)
    for file_dict in file_list:
        if file_dict['isFolder']:
            if (current_path is None):
                returned_file_list.extend(self.get_repository_file_list(repository=repository, base_path=base_path, current_path=file_dict['title']))
            else:
                sub_path = os.path.join(current_path, file_dict['title'])
                returned_file_list.extend(self.get_repository_file_list(repository=repository, base_path=base_path, current_path=sub_path))
        elif (current_path is not None):
            returned_file_list.append(os.path.join(current_path, file_dict['title']))
        else:
            returned_file_list.append(file_dict['title'])
    return returned_file_list
