From 11048fc69882e69f70904dc7fe82f7e1506182c8 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Mon, 8 Jan 2007 16:34:12 +0000 Subject: [PATCH] - if the appropriate message template doesn't exist log error and exit without throwing exception --- PLC/Methods/BootNotifyOwners.py | 4 ++-- PLC/Persons.py | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/PLC/Methods/BootNotifyOwners.py b/PLC/Methods/BootNotifyOwners.py index 7de5a1a8..418905da 100644 --- a/PLC/Methods/BootNotifyOwners.py +++ b/PLC/Methods/BootNotifyOwners.py @@ -29,8 +29,8 @@ class BootNotifyOwners(Method): def call(self, auth, message_id, include_pis, include_techs, include_support): messages = Messages(self.api, [message_id], enabled = True) if not messages: - # raise PLCInvalidArgument, "No such message template" - return 1 + print >> log, "No such message template" + return 1 message = messages[0] if not self.api.config.PLC_MAIL_ENABLED: diff --git a/PLC/Persons.py b/PLC/Persons.py index 54e6a86c..4261bfc8 100644 --- a/PLC/Persons.py +++ b/PLC/Persons.py @@ -4,7 +4,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: Persons.py,v 1.26 2007/01/05 15:56:16 tmack Exp $ +# $Id: Persons.py,v 1.28 2007/01/05 19:50:20 tmack Exp $ # from types import StringTypes @@ -16,6 +16,7 @@ import re import crypt from PLC.Faults import * +from PLC.Debug import log from PLC.Parameter import Parameter from PLC.Filter import Filter from PLC.Table import Row, Table @@ -300,9 +301,10 @@ class Person(Row): "%s %s" % ('Planetlab', 'Support') # fill in template - messages = Messages(self.api, ['PASSWORD_RESET_INITIATE']) + messages = Messages(self.api, ['ASSWORD_RESET_INITIATE']) if not messages: - raise PLCAPIError, "Email template not found" + print >> log, "No such message template" + return 1 message = messages[0] subject = message['subject'] @@ -341,7 +343,8 @@ class Person(Row): # fill in template messages = Messages(self.api, ['ACCOUNT_REGISTERED']) if not messages: - raise PLCAPIError, "Email template not found" + print >> log, "No such message template" + return 1 message = messages[0] subject = message['subject'] % (user_full_name, site['name']) -- 2.47.0