From: Ansgar Burchardt Date: Wed, 25 May 2011 18:16:29 +0000 (+0000) Subject: daklib/utils.py (parse_deb822, parse_changes): use session_wrapper X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42b695c3cb0d5a6e830d7473441bbe09e8f09b3c;p=dak daklib/utils.py (parse_deb822, parse_changes): use session_wrapper Signed-off-by: Ansgar Burchardt --- diff --git a/daklib/utils.py b/daklib/utils.py index 7c1243c9..a9909c66 100755 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -152,9 +152,10 @@ def extract_component_from_section(section): ################################################################################ -def parse_deb822(armored_contents, signing_rules=0, keyrings=None): +@session_wrapper +def parse_deb822(armored_contents, signing_rules=0, keyrings=None, session=None): if keyrings == None: - keyrings = [ k.keyring_name for k in DBConn().session().query(Keyring).filter(Keyring.active == True).all() ] + keyrings = [ k.keyring_name for k in session.query(Keyring).filter(Keyring.active == True).all() ] require_signature = True if signing_rules == -1: require_signature = False @@ -226,7 +227,8 @@ def parse_deb822(armored_contents, signing_rules=0, keyrings=None): ################################################################################ -def parse_changes(filename, signing_rules=0, dsc_file=0, keyrings=None): +@session_wrapper +def parse_changes(filename, signing_rules=0, dsc_file=0, keyrings=None, session=None): """ Parses a changes file and returns a dictionary where each field is a key. The mandatory first argument is the filename of the .changes @@ -255,7 +257,7 @@ def parse_changes(filename, signing_rules=0, dsc_file=0, keyrings=None): unicode(content, 'utf-8') except UnicodeError: raise ChangesUnicodeError, "Changes file not proper utf-8" - changes = parse_deb822(content, signing_rules, keyrings=keyrings) + changes = parse_deb822(content, signing_rules, keyrings=keyrings, session=session) if not dsc_file: