summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-04-22 16:49:54 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-04-22 16:49:54 +0000
commit34483de76d310031525821ef56b03110fc09ef7a (patch)
tree3e7c3300177ef9a20cbc35534cb8028b2b9113a2
parentbba462cbdce656255ce8c4640aa1554de2e08f01 (diff)
downloadlorry-controller-34483de76d310031525821ef56b03110fc09ef7a.tar.gz
Simplify code by using "with ... as ..."
-rw-r--r--lorrycontroller/jobupdate.py3
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: