Denormalize accounts before trying to send e-mail
authorSverre Rabbelier <srabbelier@gmail.com>
Sat, 28 Feb 2009 00:10:07 +0000
changeset 1548 15caebd3304d
parent 1547 c8c269ef0498
child 1549 bd07b231fe39
Denormalize accounts before trying to send e-mail Otherwise accounts that are in the auth domain are not a valid e-mail address. Patch by: Sverre Rabbelier
app/soc/logic/helper/notifications.py
app/soc/logic/mail_dispatcher.py
--- a/app/soc/logic/helper/notifications.py	Sat Feb 28 00:09:34 2009 +0000
+++ b/app/soc/logic/helper/notifications.py	Sat Feb 28 00:10:07 2009 +0000
@@ -33,6 +33,7 @@
 
 # We cannot import soc.logic.models notification nor user here
 # due to cyclic imports
+from soc.logic import accounts
 from soc.logic import dicts
 from soc.logic import mail_dispatcher
 from soc.views.helper import redirects
@@ -182,11 +183,13 @@
     # no valid sender found, abort
     return
 
+  to = accounts.denormalizeAccount(notification_entity.scope.account).email()
+
   # create the message contents
   messageProperties = {
       'to_name': notification_entity.scope.name,
       'sender_name': current_user_entity.name,
-      'to': notification_entity.scope.account.email(),
+      'to': to,
       'sender': sender,
       'subject': force_unicode(DEF_NEW_NOTIFICATION_MSG),
       'notification' : notification_entity,
@@ -216,12 +219,14 @@
     # no valid sender found, should not happen but abort anyway
     return
 
+  to = accounts.denormalizeAccount(user_entity.account).email()
+
   # create the message contents
   messageProperties = {
       'to_name': user_entity.name,
       'sender_name': site_name,
       'site_name': site_name,
-      'to': user_entity.account.email(),
+      'to': to,
       'sender': sender,
       'subject': DEF_WELCOME_MSG_FMT % {
           'site_name': site_name,
--- a/app/soc/logic/mail_dispatcher.py	Sat Feb 28 00:09:34 2009 +0000
+++ b/app/soc/logic/mail_dispatcher.py	Sat Feb 28 00:10:07 2009 +0000
@@ -68,6 +68,7 @@
 
 from google.appengine.api import mail
 
+from soc.logic import accounts
 from soc.logic import dicts
 
 
@@ -145,4 +146,4 @@
     logging.warning('Non-Authenticated user triggered getDefaultMailSender')
     return None
 
-  return account_entity.email()
+  return accounts.denormalizeAccount(account_entity).email()