]> git.decadent.org.uk Git - dak.git/commitdiff
daklib/utils.py (parse_deb822, parse_changes): use session_wrapper
authorAnsgar Burchardt <ansgar@debian.org>
Wed, 25 May 2011 18:16:29 +0000 (18:16 +0000)
committerAnsgar Burchardt <ansgar@debian.org>
Wed, 25 May 2011 18:16:29 +0000 (18:16 +0000)
Signed-off-by: Ansgar Burchardt <ansgar@debian.org>
daklib/utils.py

index 7c1243c91e123add4bfbce3537f212331344ac3d..a9909c66004ec2748321e8b74857237c15c5c43f 100755 (executable)
@@ -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: