X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=23aeda6fdad5ae52109eac5fb4f5989d2eb28463;hb=43dabc892b347a25ef7f214fd929c7d46bc83213;hp=4669cfc891efec4f9c0dd5eccaf91aaf84260321;hpb=1c35448b880358d020e81339657e3435fdda9434;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 4669cfc8..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): @@ -1579,7 +1604,7 @@ class Queue(object): # If it does, update things to ensure it's not removed prematurely else: - qb = get_queue_build(dest, suite_id, session) + qb = get_queue_build(dest, s.suite_id, session) if qb is None: qb.in_queue = True qb.last_used = None