errors as JSON if application/json is in Accept (bug 1013440)
Merge pull request #466 from mstriemer/json-error-messages-1013440

Show errors as JSON if application/json is in Accept (bug 1013440)
Prevent checking `in` on `None`