From: Frank Lichtenheld Date: Fri, 30 Oct 2009 22:02:47 +0000 (+0000) Subject: changes: Use @session_wrapper X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0df6ae5464efede5f45ff3a02bf42c2e24cd25da;p=dak changes: Use @session_wrapper Signed-off-by: Frank Lichtenheld --- diff --git a/daklib/changes.py b/daklib/changes.py index fd09cb7f..dd5e373c 100755 --- a/daklib/changes.py +++ b/daklib/changes.py @@ -177,31 +177,20 @@ class Changes(object): return summary + @session_wrapper def remove_known_changes(self, session=None): - if session is None: - session = DBConn().session() - privatetrans = True - session.delete(get_knownchange(self.changes_file, session)) - if privatetrans: - session.commit() - session.close() - - def mark_missing_fields(self): """add "missing" in fields which we will require for the known_changes table""" for key in ['urgency', 'maintainer', 'fingerprint', 'changed-by' ]: if (not self.changes.has_key(key)) or (not self.changes[key]): self.changes[key]='missing' + @session_wrapper def add_known_changes(self, dirpath, session=None): """add "missing" in fields which we will require for the known_changes table""" cnf = Config() - privatetrans = False - if session is None: - session = DBConn().session() - privatetrans = True changesfile = os.path.join(dirpath, self.changes_file) filetime = datetime.datetime.fromtimestamp(os.path.getctime(changesfile)) diff --git a/daklib/dbconn.py b/daklib/dbconn.py index bdb9ab4f..bdd72fb3 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -124,6 +124,8 @@ def session_wrapper(fn): return wrapped +__all__.append('session_wrapper') + ################################################################################ class Architecture(object):