Skip to content
This repository was archived by the owner on Oct 2, 2023. It is now read-only.
This repository was archived by the owner on Oct 2, 2023. It is now read-only.

ToopherIframe.validate mutates the data parameter, which might be immutable #29

@smholloway

Description

@smholloway

In Flask, the request data is an ImmutableMultiDict, so the ToopherIframe.validate method will throw an error when trying to delete the Toopher signature.

Here's how I called validate:

validated_data = api.validate(request.args, request_token)

And this is the line that threw the error:

del data['toopher_sig']

I suggest we make a mutable copy of the data that we can manipulate and return. There's probably a cleaner way to do it, but this is how I got around it in my example:

mutable_dict = {}
for key in data.keys():
    mutable_dict[key] = data[key]

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

    Issue actions