Wrap local-id computation in transaction.atomic()

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

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.

reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/managers.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/managers.py
    
    
  2. 
      
brennie
  1. Ship It!
  2. 
      
chipx86
  1. Ship It!
  2. 
      
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-3.0.x (f0ce2b3)
Loading...