From: Mark Hymers Date: Fri, 1 Apr 2011 15:51:27 +0000 (+0000) Subject: Don't end up with multiple database sessions in check_sig call X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24dc52e8ca3a308111b7f41b0b2065ec0a103c7a;p=dak Don't end up with multiple database sessions in check_sig call Signed-off-by: Mark Hymers --- diff --git a/daklib/utils.py b/daklib/utils.py index 707d3b85..82dd4ca2 100755 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -39,7 +39,7 @@ import re import email as modemail import subprocess -from dbconn import DBConn, get_architecture, get_component, get_suite, get_override_type, Keyring +from dbconn import DBConn, get_architecture, get_component, get_suite, get_override_type, Keyring, session_wrapper from dak_exceptions import * from textutils import fix_maintainer from regexes import re_html_escaping, html_escaping, re_single_line_field, \ @@ -1307,8 +1307,8 @@ def gpg_keyring_args(keyrings=None): return " ".join(["--keyring %s" % x for x in keyrings]) ################################################################################ - -def check_signature (sig_filename, data_filename="", keyrings=None, autofetch=None): +@session_wrapper +def check_signature (sig_filename, data_filename="", keyrings=None, autofetch=None, session=None): """ Check the signature of a file and return the fingerprint if the signature is valid or 'None' if it's not. The first argument is the @@ -1336,7 +1336,7 @@ def check_signature (sig_filename, data_filename="", keyrings=None, autofetch=No return (None, rejects) if not keyrings: - keyrings = [ x.keyring_name for x in DBConn().session().query(Keyring).filter(Keyring.active == True).all() ] + keyrings = [ x.keyring_name for x in session.query(Keyring).filter(Keyring.active == True).all() ] # Autofetch the signing key if that's enabled if autofetch == None: