Skip to content

get_params method should seek at 0 on the file stream #39

Closed
@chfw

Description

@chfw
Member

continuing with #26, explicit seeking at 0 on the file stream could help avoid #37.

def get_params(self, **keywords):
    extension = self.name.split(".")[-1]
    keywords['file_type'] = extension
    self.file.seek(0) # <--
    content = self.file.read()
    if content:
        keywords['file_content'] = content
    else:
        raise IOError("No content was uploaded.")
    return keywords

Activity

added a commit that references this issue on Jul 6, 2017

test #39, stringio has been read() can be read() again by seeking at 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @chfw

        Issue actions

          get_params method should seek at 0 on the file stream · Issue #39 · pyexcel-webwares/django-excel