Wrap local-id computation in transaction.atomic()

Review Request #8710 — Created Feb. 3, 2017 and submitted — Latest diff uploaded

Information

Review Board
release-3.0.x
f06effb...

Reviewers

We have some custom SQL that has to run to compute the local-site specific ID
for review requests. Previously, we called transaction.commit() after doing
this, which works fine in production, but is problematic when running under
Django 1.8's unit test class, which puts the entire test case into an atomic
block.

Instead of manually calling transaction.commit(), I've wrapped the SQL in its
own atomic block. In production, this acts the same as calling commit()
afterwards, but in the test case (where it's a nested atomic block), it runs as
a "save point", doing the right thing instead of crashing.

Ran unit tests on 1.6 and 1.8.