X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=23aeda6fdad5ae52109eac5fb4f5989d2eb28463;hb=bc845036c1e9e2c2fca180e2fc8aa2aa72252107;hp=556921eae2c039a2ce3d6cbe12202a47a0f9b0fb;hpb=f558a3d8c95f65f905d46681c1d43e6986fee256;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 556921ea..23aeda6f 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -1095,6 +1095,31 @@ def get_or_set_maintainer(name, session=None): __all__.append('get_or_set_maintainer') +def get_maintainer(maintainer_id, session=None): + """ + Return the name of the maintainer behind C{maintainer_id} or None if that + maintainer_id is invalid. + + @type maintainer_id: int + @param maintainer_id: the id of the maintainer + + @rtype: Maintainer + @return: the Maintainer with this C{maintainer_id} + """ + + privatetrans = False + if session is None: + session = DBConn().session() + privatetrans = True + + try: + return session.query(Maintainer).get(maintainer_id) + finally: + if privatetrans: + session.close() + +__all__.append('get_maintainer') + ################################################################################ class NewComment(object):