BUG FIX: prevents the database for accepting furthur database queries when _find_user() fails in ReviewRequestDraftResource

Review Request #6559 — Created Nov. 5, 2014 and submitted — Latest diff uploaded

Information

Review Board
master
0b75a40...

Reviewers

The problem occurs when a PUT webAPI call goes to ReviewRequestDraftResource and find_user() returns None. We then try to add None to the database, which generates an error, aborting the transaction, and prevents any further database queries.

Now, after find_user() is called the return value is tested; if None then it throws an ObjectDoesNotExist exception and skips getting added to the database. In update() it checks for invalid_fields, which will contain target_people if no user was found and returns a webAPI error of INVALID_FORM_DATA. So the HTTP response gives an informative error, and None never gets added to the database.

The Unit test asserts that find_user() returns null, then checks that find_user() is called, checks the response code for 105 (INVALID_FORM_DATA), and that there is no TransactionManagmentError thrown by the database.

    Loading...