-
Notifications
You must be signed in to change notification settings - Fork 34
AttributeError when de/serializing models with DateTime columns. #19
Comments
Got a stack trace I can take a look at? |
Yup, here it is:
|
I should be able to look at this tonight, what database are you using? |
OK great. I'm using MySQL with the pymysql driver. If necessary, I can send you the link to a test project where you can reproduce this error |
That'd be fantastic |
@justanr sure thing: https://github.com/kiptoomm/flask_and_restless You wanna check out the branch 'test_marshmallow'. The commit that introduces the issue is 5eef4ad6ee508416bc0a7621241fb0c404e13b9b |
I was able to reproduce this issue, however I don't think the issue is with this library. I dumped the
Compare to the one generated by the GET:
Note that this has the actual enum value where as the result of the patch has the string representation. Given that the GET and POST don't usually explode (I put a raise in there), I'm going to hazard a guess that the issue probably lies in the glue between |
@justanr do you have a gist that I can look at where you printed the |
I simply tossed a |
Thanks for sending me in the right direction, @justanr. I think I've found the issue and following up with the flask-restless community. Details here: jfinkels/flask-restless#679 |
I am stumped by this error that arises when de/serializing a model that defines sqlalchemy.DateTime fields:
AttributeError: 'unicode' object has no attribute 'name'
Here is the skeleton of my project:
I see this error when making PATCH requests against
EnumField
s (using flask-restless to simplify API creation). PATCHing non-enum fields of the model works just fine.The error does not occur when I remove the timestamp fields from the Author model. I'm not sure why the presence of a
DateTime
would impact theEnumField
serialization. Any idea?The text was updated successfully, but these errors were encountered: