def take_snapshot(api, folder, team_members): # Create a folder current_time = datetime.datetime.now() time_string = str(datetime.datetime.now()) output_folder = os.path.join(folder, time_string) os.mkdir(output_folder) projects = api.projects.list(member=team_members) for proj in projects: project = Project(proj, current_time) project.dump(output_folder) for st in api.user_stories.list(project=project.id): story = UserStory(st, current_time) story.dump(output_folder) for st in api.user_story_statuses.list(project=project.id): status = Status(st, current_time) status.dump(output_folder)
def __load_data(self, folder): self._stories = {} self._status = {} self._projects = {} for filename in glob.glob(os.path.join(folder, "*.story")): story = UserStory.load(filename) self._stories[story.id] = story for filename in glob.glob(os.path.join(folder, "*.proj")): proj = Project.load(filename) self._projects[proj.id] = proj for filename in glob.glob(os.path.join(folder, "*.status")): status = Status.load(filename) self._status[status.id] = status