X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=b63b4a9380d1fed873d0031e25dd1286e08055cc;hb=79580b4e9a21dfbdae877af9890ba4b3f84e7c63;hp=556921eae2c039a2ce3d6cbe12202a47a0f9b0fb;hpb=f558a3d8c95f65f905d46681c1d43e6986fee256;p=dak.git 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):