(story, sketch, story_exporter, zip_file)
Export a story from a sketch into a ZIP file.

    Args:
        story (timesketch.models.sketch.Story): a story object.
        sketch (timesketch.models.sketch.Sketch): a sketch object.
        story_exporter (timesketch.lib.stories.StoryExporter): an instance of
            a story exporter that can be used to export story content.
        zip_file (ZipFile): a zip file handle that can be used to write
            content to.
Export a story from a sketch into a ZIP file.
Export a story from a sketch into a ZIP file .
def export_story(story, sketch, story_exporter, zip_file):
    """Export a story from a sketch into a ZIP file.

    Args:
        story (timesketch.models.sketch.Story): a story object.
        sketch (timesketch.models.sketch.Sketch): a sketch object.
        story_exporter (timesketch.lib.stories.StoryExporter): an instance of
            a story exporter that can be used to export story content.
        zip_file (ZipFile): a zip file handle that can be used to write
            content to.
    """
    with story_exporter() as exporter:
        data_fetcher = story_api_fetcher.ApiDataFetcher()
        data_fetcher.set_sketch_id(sketch.id)

        exporter.set_data_fetcher(data_fetcher)
        exporter.from_string(story.content)
        exporter.set_creation_date(story.created_at.isoformat())
        if story.user:
            author = story.user.username
        else:
            author = 'System'
        exporter.set_author(author)
        exporter.set_title(story.title)

        zip_file.writestr(
            'stories/{0:04d}_{1:s}.html'.format(
                story.id, story.title),
            data=exporter.export_story())
def export_story ( story , sketch , story_exporter , zip_file ) : with story_exporter ( ) as exporter : data_fetcher = story_api_fetcher . ApiDataFetcher ( ) data_fetcher . set_sketch_id ( sketch . id ) exporter . set_data_fetcher ( data_fetcher ) exporter . from_string ( story . content ) exporter . set_creation_date ( story . created_at . isoformat ( ) ) if story . user : author = story . user . username else : author = 'System' exporter . set_author ( author ) exporter . set_title ( story . title ) zip_file . writestr ( 'stories/{0:04d}_{1:s}.html' . format ( story . id , story . title ) , data = exporter . export_story ( ) )