Wrap local-id computation in transaction.atomic()
Wrap local-id computation in transaction.atomic()

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.

Testing done:
Ran unit tests on 1.6 and 1.8.

Reviewed at https://reviews.reviewboard.org/r/8710/

davidt/reviewboard,reviewboard/reviewboard,sgallagher/reviewboard,sgallagher/reviewboard,chipx86/reviewboard,reviewboard/reviewboard,brennie/reviewboard,chipx86/reviewboard,brennie/reviewboard,chipx86/reviewboard,chipx86/reviewboard,davidt/reviewboard,reviewboard/reviewboard,sgallagher/reviewboard,sgallagher/reviewboard,reviewboard/reviewboard,davidt/reviewboard,brennie/reviewboard,davidt/reviewboard,brennie/reviewboard