From 1affcd22562a0887621eff25fb952fb132c9f584 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Fri, 25 Jun 2010 14:16:35 +0200 Subject: [PATCH] =?UTF-8?q?Corretto=20invio=20alla=20email=20dell'utente?= =?UTF-8?q?=20quando=20questa=20non=20=C3=A8=20impostata=20e=20aggiunto=20?= =?UTF-8?q?get=5Fusername=20()=20per=20determinare=20l'utente=20proprietar?= =?UTF-8?q?io=20del=20download.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mlmanager.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mlmanager.py b/mlmanager.py index 3af88dc..1f99eb4 100644 --- a/mlmanager.py +++ b/mlmanager.py @@ -169,8 +169,12 @@ class Download(): self._owner = os.getenv("FILE_OWNER") self._incoming = incoming - + + # This could be none, and if it's empty + # we should set it to None self._user_email = os.getenv("USER_EMAIL") + if self._user_email is "": + self._user_email = None # The file is not yet committed. You will need to commit it # before trying to move it. If we do not have authentication @@ -340,10 +344,12 @@ class Download(): if isinstance(recipients, str): recipients = [ recipients ] - # Add user email if requested + # Add user email if requested, and if present in the + # profile of the user if "owner" in recipients: recipients.remove("owner") - recipients.append(self._user_email) + if self._user_email is not None: + recipients.append(self._user_email) msg['To'] = ", ".join(recipients) msg['Subject'] = subject @@ -379,6 +385,10 @@ class Download(): def get_group(self): """Return group""" return self._group + + def get_username(self): + """Return duration""" + return self._username def get_duration(self): """ -- 2.1.4