From 42b695c3cb0d5a6e830d7473441bbe09e8f09b3c Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt Date: Wed, 25 May 2011 18:16:29 +0000 Subject: [PATCH] daklib/utils.py (parse_deb822, parse_changes): use session_wrapper Signed-off-by: Ansgar Burchardt --- daklib/utils.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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: -- 2.39.5