You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Getting an AttributeError when using validates decorator with AssertionError #28
When adding model field validation with sqlalchemy's @validates decorator as illustrated in the docs I get the error AttributeError: 'AssertionError' object has no attribute 'msg'. It seems sqlalchemy-jsonapi is trying to access the exception message through e.msg where it should be accessible through e directly. I'm assuming this change happened with Python 3?
changed the title [-]AttributeError when using validates decorator with AssertionError[/-][+]Getting an AttributeError when using validates decorator with AssertionError[/+]on Sep 12, 2016
It's actually just bad code. Python 2 has e.message but neither Python 2 or 3 has a msg attribute. As I said in the PR, I think we can just raise the caught exception. It's kind of scary this doesn't get caught by the test coverage, which would seem to indicate our tests aren't very robust.
btw, I'm helping Colton get patches reviewed and landed. I just started helping out. Sorry this issue and patch have been sitting for awhile.
Activity
[-]AttributeError when using validates decorator with AssertionError[/-][+]Getting an AttributeError when using validates decorator with AssertionError[/+]Fix fetching of AssertionError message for Python 3
Fix fetching of AssertionError message for Python 3
Fix fetching of AssertionError message for Python 3
Anderycks commentedon Feb 24, 2017
It's actually just bad code. Python 2 has
e.messagebut neither Python 2 or 3 has amsgattribute. As I said in the PR, I think we can just raise the caught exception. It's kind of scary this doesn't get caught by the test coverage, which would seem to indicate our tests aren't very robust.btw, I'm helping Colton get patches reviewed and landed. I just started helping out. Sorry this issue and patch have been sitting for awhile.