Skip to content

Generator objects cannot be passed into CSVStreamingRenderer #69

@jrzerr

Description

@jrzerr

CSVStreamingRenderer is great, it works as a generator along with tabelize which also works as a generator. However, you cannot pass a Generator object in as your data to be rendered. This code in CSVStreamingRenderer causes the issue:

        if not isinstance(data, list):
            data = [data]

A generator object is not a type list, so the if statement evaluates to true so this code breaks the renderer for a Generator object.

I have successfully used this with a generator as the data source by changing that to:

        if not isinstance(data, GeneratorType) and not isinstance(data, list):
            data = [data]

PR on it's way...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions