[dak/master] Port get_maintainer to dbconn.
Signed-off-by: Chris Lamb <lamby@debian.org>
---
daklib/dbconn.py | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/daklib/dbconn.py b/daklib/dbconn.py
index 556921e..b63b4a9 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):
--
1.5.6.5
Reply to: