Fix unsafe behavior in marshmallow class for contributions.

This commit is contained in:
Will O'Beirne 2019-02-25 15:04:33 -05:00
parent 5cb08a1f14
commit 8a193756b3
No known key found for this signature in database
GPG Key ID: 44C190DB5DEAF9F6
1 changed files with 2 additions and 2 deletions

View File

@ -736,11 +736,11 @@ class ProposalContributionSchema(ma.Schema):
}
def get_is_anonymous(self, obj):
return not obj.user
return not obj.user_id
@post_dump
def stub_anonymous_user(self, data):
if not data['user']:
if 'user' in data and data['user'] is None:
data['user'] = anonymous_user
return data