data deserialization issue..

Create issue
Issue #17 resolved
Yasser Wahba created an issue

DynamoDBModel.__init__ is not a "drop-in" replacement for from_dict as one might deduce from the change log:

  1. _dynamodb_to_python should be called before setting the attribute.
  2. constructor does not accept a dict object(should it?)

Comments (4)

  1. Jean-Tiare Le Bigot

    Thanks for reporting.

    Indeed, the constructor is designed to accept **kwargs. You can use it as a "drop-in" replacement by adding ** before the dict. This will instruct Python to "extend" the dictionary into named arguments.

    But there is a regression bug in this approach because we do not coerce the types in the constructor whereas we did in from_dict.

    I target a fix for 1.7.1

  2. Éric Araujo

    I think it’s acceptable to have __init__ require the real Python types as defined in the schema. If you write Python code, you use Python types. It’s a minor annoyance when converting code, but it’s cleaner in the long run in my opinion.

  3. Log in to comment