From 79580b4e9a21dfbdae877af9890ba4b3f84e7c63 Mon Sep 17 00:00:00 2001
From: Chris Lamb <lamby@debian.org>
Date: Mon, 26 Oct 2009 13:54:02 +0000
Subject: [PATCH] Port get_maintainer to dbconn.

Signed-off-by: Chris Lamb <lamby@debian.org>
---
 daklib/dbconn.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/daklib/dbconn.py b/daklib/dbconn.py
index 556921ea..b63b4a93 100755
--- a/daklib/dbconn.py
+++ b/daklib/dbconn.py
@@ -1095,6 +1095,30 @@ def get_or_set_maintainer(name, session=None):
 
 __all__.append('get_or_set_maintainer')
 
+def get_maintainer(maintainer_id, session=True):
+    """
+    Return the name of the maintainer behind C{maintainer_id}.
+
+    @type maintainer_id: int
+    @param maintainer_id: the id of the maintainer
+
+    @rtype: string
+    @return: the name of the maintainer
+    """
+
+    privatetrans = False
+    if session is None:
+        session = DBConn().session()
+        privatetrans = True
+
+    try:
+        return session.query(Maintainer).get(maintainer_id).name
+    finally:
+        if privatetrans:
+            session.close()
+
+__all__.append('get_maintainer')
+
 ################################################################################
 
 class NewComment(object):
-- 
2.39.5