From: Tony Mack Date: Mon, 6 Oct 2008 17:48:19 +0000 (+0000) Subject: Send user an email when thier account has been disable or enabled. This should help... X-Git-Tag: PLCAPI-4.3-2~25 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=57fc659826a046c91d050f8be40a9c80ec7ca9d4;p=plcapi.git Send user an email when thier account has been disable or enabled. This should help to resolve some registration/verification confusion --- diff --git a/PLC/Methods/UpdatePerson.py b/PLC/Methods/UpdatePerson.py index 8f74fc0..61b8e26 100644 --- a/PLC/Methods/UpdatePerson.py +++ b/PLC/Methods/UpdatePerson.py @@ -3,6 +3,7 @@ from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Persons import Person, Persons from PLC.Auth import Auth +from PLC.sendmail import sendmail related_fields = Person.related_fields.keys() can_update = lambda (field, value): field in \ @@ -62,7 +63,19 @@ class UpdatePerson(Method): person.update(person_fields) person.update_last_updated(False) person.sync() - + + if 'enabled' in person_fields: + To = [("%s %s" % (person['first_name'], person['last_name']), person['email'])] + Cc = [] + if person['enabled']: + Subject = "PlanetLab account enabled" + Body = "Your PlanetLab account has been enabled. You should now be allowd to access you account" + else: + Subject = "PlanetLab account disabled" + Body = "Your PlanetLab account has been disabled. Please contact your PI or PlanetLab support for more information" + sendmail(self.api, To = To, Cc = Cc, Subject = Subject, Body = Body) + + # Logging variables self.event_objects = {'Person': [person['person_id']]}