Issue #21 wontfix

String (str) being rejected for not being of type unicode

Erik Wickstrom
created an issue

I just upgraded from an early release (1.2) to 1.8 and am getting this error:

InvalidList: expected value of type unicode. Got 'en' of type <type 'str'> for dictionary value @ data['lang']

My schema calls for the field to be a unicode type, but up till now would accept a standard Python string. Shouldn't dnamodb-mapper automatically coerce a string into unicode?

Comments (3)

  1. Max Noel

    No, that is intended behavior.

    In the general case, bytestrings can't be coerced to unicode (or the other way around) -- you run into errors as soon as you start including non-ascii characters. Validation got stricter in recent versions of DDBM, and I apologize for the breaking changes, but it'll save a lot of trouble further down the road, especially now that DynamoDB has a separate datatype for arbitrary binary data (which maps to Python bytestrings).

  2. Log in to comment