forked from adamm/git-importer
Make use of db.cursor() in with blocks
This commit is contained in:
@@ -12,13 +12,13 @@ class Exporter:
|
||||
|
||||
def run(self):
|
||||
db = DB()
|
||||
cur = db.cursor()
|
||||
cur.execute(
|
||||
"SELECT * from revisions where package=%s ORDER BY project,rev",
|
||||
(self.package,),
|
||||
)
|
||||
data = {"revisions": []}
|
||||
for row in cur.fetchall():
|
||||
data["revisions"].append(DBRevision(row).as_dict(db))
|
||||
with db.cursor() as cur:
|
||||
cur.execute(
|
||||
"SELECT * from revisions where package=%s ORDER BY project,rev",
|
||||
(self.package,),
|
||||
)
|
||||
data = {"revisions": []}
|
||||
for row in cur.fetchall():
|
||||
data["revisions"].append(DBRevision(row).as_dict(db))
|
||||
|
||||
yaml.dump(data, sys.stdout, default_flow_style=False)
|
||||
|
Reference in New Issue
Block a user