From 97f565f26006d3866daaf39ee6512567b20cb01b Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Mon, 26 Oct 2009 14:04:51 +0000 Subject: [PATCH] Alter get_maintainer API to return Maintainer object or None Signed-off-by: Chris Lamb --- dak/rm.py | 2 +- daklib/dbconn.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dak/rm.py b/dak/rm.py index 1b6dfe1f..c2a07e8a 100755 --- a/dak/rm.py +++ b/dak/rm.py @@ -457,7 +457,7 @@ def main (): maintainer_list = [] for maintainer_id in maintainers.keys(): - maintainer_list.append(get_maintainer(maintainer_id)) + maintainer_list.append(get_maintainer(maintainer_id).name) summary = "" removals = d.keys() removals.sort() diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 30d1d7d6..23aeda6f 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -1097,13 +1097,14 @@ __all__.append('get_or_set_maintainer') def get_maintainer(maintainer_id, session=None): """ - Return the name of the maintainer behind C{maintainer_id}. + 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: string - @return: the name of the maintainer + @rtype: Maintainer + @return: the Maintainer with this C{maintainer_id} """ privatetrans = False @@ -1112,7 +1113,7 @@ def get_maintainer(maintainer_id, session=None): privatetrans = True try: - return session.query(Maintainer).get(maintainer_id).name + return session.query(Maintainer).get(maintainer_id) finally: if privatetrans: session.close() -- 2.39.5