Skip to content

json encoding and decoding does not always work together #10

@gkhaburzaniya

Description

@gkhaburzaniya

Python 3.4, botoflow 0.8, django 1.9

When the cause of an ActivityTaskFailed is that a django model's .get() raised DoesNotExist, or MultipleObjectsReturned (and probably for many other errors). The JSON encoder encodes this into the details here

https://github.com/boto/botoflow/blob/master/botoflow/data_converter/json_data_converter.py#L152

That leads to something like this "__obj": [ "app.models:DoesNotExist", {}]

Which causes an error when trying to decode it here https://github.com/boto/botoflow/blob/master/botoflow/data_converter/json_data_converter.py#L189, since app.models does not have DoesNotExist, the DoesNotExist is part of the model class which raised the error. IMO, the encoding should write something like

        "__obj": [
            "app.models:ModelName.DoesNotExist",
            {}]

instead. That might be impossible though :(

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