From 62d54f3df1def1ed5b7b2369c964e0a99a77a423 Mon Sep 17 00:00:00 2001 From: Dimitur Kirov Date: Tue, 9 Aug 2005 17:57:53 +0000 Subject: [PATCH] added method get_prim_contact_from_list --- src/common/helpers.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/common/helpers.py b/src/common/helpers.py index 8381906fd..c51b8967c 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -25,6 +25,14 @@ from common import i18n _ = i18n._ +def get_prim_contact_from_list(contacts): + prim_contact = None # primary contact + for contact in contacts: + if prim_contact == None or int(contact.priority) > \ + int(prim_contact.priority): + prim_contact = contact + return prim_contact + def convert_bytes(string): suffix = '' # IEC standard says KiB = 1024 bytes KB = 1000 bytes