From: Chris Lamb Date: Mon, 26 Oct 2009 13:54:02 +0000 (+0000) Subject: Port get_maintainer to dbconn. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79580b4e9a21dfbdae877af9890ba4b3f84e7c63;p=dak Port get_maintainer to dbconn. Signed-off-by: Chris Lamb --- 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):