app/soc/logic/helper/notifications.py
changeset 2068 f5e8fbbd3bea
parent 1894 da52a47b5a6b
child 2170 cec46675f866
equal deleted inserted replaced
2067:9b58b42c6b53 2068:f5e8fbbd3bea
   144       'reviewed_name': reviewed_name,
   144       'reviewed_name': reviewed_name,
   145       }
   145       }
   146 
   146 
   147   # determine the subject
   147   # determine the subject
   148   review_type = 'public' if review.is_public else 'private'
   148   review_type = 'public' if review.is_public else 'private'
   149   subject =  DEF_NEW_REVIEW_SUBJECT_FMT %(review_type, reviewed_name)
   149   subject =  DEF_NEW_REVIEW_SUBJECT_FMT % (review_type, reviewed_name)
   150 
   150 
   151   template = DEF_NEW_REVIEW_NOTIFICATION_TEMPLATE
   151   template = DEF_NEW_REVIEW_NOTIFICATION_TEMPLATE
   152 
   152 
   153   # send the notification from the system
   153   # send the notification from the system
   154   sendNotification(to_user, None, message_properties, subject, template)
   154   sendNotification(to_user, None, message_properties, subject, template)
   167 
   167 
   168   if from_user:
   168   if from_user:
   169     sender_name = from_user.name
   169     sender_name = from_user.name
   170   else:
   170   else:
   171     site_entity = model_logic.site.logic.getSingleton()
   171     site_entity = model_logic.site.logic.getSingleton()
   172     sender_name = 'The %s Team' %(site_entity.site_name)
   172     sender_name = 'The %s Team' % (site_entity.site_name)
   173 
   173 
   174   new_message_properties = {
   174   new_message_properties = {
   175       'sender_name': sender_name,
   175       'sender_name': sender_name,
   176       'to_name': to_user.name,
   176       'to_name': to_user.name,
   177       }
   177       }
   183   fields = {
   183   fields = {
   184       'from_user': from_user,
   184       'from_user': from_user,
   185       'subject': subject,
   185       'subject': subject,
   186       'message': message,
   186       'message': message,
   187       'scope': to_user,
   187       'scope': to_user,
   188       'link_id': 't%i' %(int(time.time()*100)),
   188       'link_id': 't%i' % (int(time.time()*100)),
   189       'scope_path': to_user.link_id
   189       'scope_path': to_user.link_id
   190   }
   190   }
   191 
   191 
   192   key_name = model_logic.notification.logic.getKeyNameFromFields(fields)
   192   key_name = model_logic.notification.logic.getKeyNameFromFields(fields)
   193 
   193