diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2014-04-22 16:49:54 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2014-04-22 16:49:54 +0000 |
commit | 34483de76d310031525821ef56b03110fc09ef7a (patch) | |
tree | 3e7c3300177ef9a20cbc35534cb8028b2b9113a2 /lorrycontroller | |
parent | bba462cbdce656255ce8c4640aa1554de2e08f01 (diff) | |
download | lorry-controller-34483de76d310031525821ef56b03110fc09ef7a.tar.gz |
Simplify code by using "with ... as ..."
Diffstat (limited to 'lorrycontroller')
-rw-r--r-- | lorrycontroller/jobupdate.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lorrycontroller/jobupdate.py b/lorrycontroller/jobupdate.py index b6ee1fe..24a3c4a 100644 --- a/lorrycontroller/jobupdate.py +++ b/lorrycontroller/jobupdate.py @@ -38,8 +38,7 @@ class JobUpdate(lorrycontroller.LorryControllerRoute): logging.info('Job %s updated (exit=%s)', job_id, exit) - statedb = self.open_statedb() - with statedb: + with self.open_statedb() as statedb: if stdout: statedb.append_to_job_output(job_id, stdout) if stderr: |