app/soc/logic/helper/notifications.py
author Lennard de Rijk <ljvderijk@gmail.com>
Wed, 17 Dec 2008 19:33:03 +0000
changeset 756 a0c0b48563cb
parent 750 6e8d67d04507
child 757 b11cee4ab535
permissions -rw-r--r--
Changed invitation email and into a notification. Also changed the public template for Notification to allow HTML code. Patch by: Lennard de Rijk
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
635
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     2
#
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     4
#
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     8
#
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    10
#
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    16
638
22ec01fdf8f4 Add missing dot and correctly sort imports in soc.logic.helper.notifications module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 635
diff changeset
    17
"""Helper functions for sending out notifications.
635
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    18
"""
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    19
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    20
__authors__ = [
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    21
  '"Lennard de Rijk" <ljvderijk@gmail.com>',
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    22
  ]
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    23
638
22ec01fdf8f4 Add missing dot and correctly sort imports in soc.logic.helper.notifications module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 635
diff changeset
    24
756
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    25
import time
638
22ec01fdf8f4 Add missing dot and correctly sort imports in soc.logic.helper.notifications module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 635
diff changeset
    26
import os
22ec01fdf8f4 Add missing dot and correctly sort imports in soc.logic.helper.notifications module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 635
diff changeset
    27
635
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    28
from google.appengine.api import users
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    29
756
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    30
from django.template import loader
635
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    31
from django.utils.translation import ugettext_lazy
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    32
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    33
from soc.logic import mail_dispatcher
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    34
from soc.views.helper import redirects
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    35
664
fb4c825b24ab Some style fixes in soc.logic.helper.notifications module. Little changes in welcome.html template.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 641
diff changeset
    36
import soc.logic.models as model_logic
635
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    37
664
fb4c825b24ab Some style fixes in soc.logic.helper.notifications module. Little changes in welcome.html template.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 641
diff changeset
    38
fb4c825b24ab Some style fixes in soc.logic.helper.notifications module. Little changes in welcome.html template.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 641
diff changeset
    39
DEF_INVITATION_MSG_FMT = ugettext_lazy(
635
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    40
    "Invitation to become a %(role)s for %(group)s")
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    41
664
fb4c825b24ab Some style fixes in soc.logic.helper.notifications module. Little changes in welcome.html template.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 641
diff changeset
    42
DEF_WELCOME_MSG_FMT = ugettext_lazy("Welcome to Melange %(name)s")
640
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
    43
635
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    44
def sendInviteNotification(entity):
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    45
  """Sends out an invite notification to the user the request is for.
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    46
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    47
  Args:
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    48
    entity : A request containing the information needed to create the message
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    49
  """
640
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
    50
  
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
    51
  # get user logic
756
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    52
  user_logic = model_logic.user.logic
635
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    53
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    54
  # get the current user
756
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    55
  current_user_entity = user_logic.getForCurrentAccount()
635
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    56
  
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    57
  # get the user the request is for
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    58
  properties = {'link_id': entity.link_id }
756
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    59
  request_user_entity = user_logic.getForFields(properties, unique=True)
635
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    60
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    61
  # create the invitation_url
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    62
  invitation_url = "%(host)s%(index)s" % {
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    63
      'host' : os.environ['HTTP_HOST'], 
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    64
      'index': redirects.inviteAcceptedRedirect(entity, None)}
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    65
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    66
  # get the group entity
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    67
  group_entity = entity.scope
756
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    68
  
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    69
  # create the properties for the message
635
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    70
  messageProperties = {
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    71
      'to_name': request_user_entity.name,
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    72
      'sender_name': current_user_entity.name,
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    73
      'role': entity.role,
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    74
      'group': group_entity.name,
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    75
      'invitation_url': invitation_url,
756
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    76
      }
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    77
  
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    78
  # render the message
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    79
  message = loader.render_to_string('soc/notification/messages/invitation.html', dictionary=messageProperties)
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    80
  
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    81
  # create the fields for the notification
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    82
  fields = { 
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    83
      'from_user' : current_user_entity,
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    84
      'subject' : DEF_INVITATION_MSG_FMT % {
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    85
          'role' : entity.role,
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    86
          'group' : group_entity.name 
635
2f5322ad1f5b Moved sendInviteMessage to a new module in logic/helper/notifications.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    87
          },
756
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    88
      'message' : message,
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    89
      'scope' : request_user_entity,
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    90
      'link_id' :'%i' % (time.time()),
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    91
      'scope_path' : request_user_entity.link_id
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    92
  }
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    93
  
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    94
  # create and put a new notification in the datastore
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    95
  notification_logic = model_logic.notification.logic
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    96
  notification_logic.updateOrCreateFromFields(fields, 
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    97
      notification_logic.getKeyFieldsFromDict(fields))
a0c0b48563cb Changed invitation email and into a notification.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 750
diff changeset
    98
  
640
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
    99
  
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   100
def sendWelcomeMessage(user_entity):
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   101
  """Sends out a welcome message to a user.
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   102
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   103
    Args:
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   104
      user_entity: User entity which the message should be send to
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   105
  """
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   106
  
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   107
  # get user logic
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   108
  user_logic = model_logic.user  
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   109
  
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   110
  # get the current user
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   111
  properties = {'account': users.get_current_user()}
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   112
  current_user_entity = user_logic.logic.getForFields(properties, unique=True)
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   113
750
6e8d67d04507 Fix too long lines in soc.logic.helper.notifications module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 664
diff changeset
   114
  # TODO(Lennard): change the message sender to some sort of no-reply adress 
6e8d67d04507 Fix too long lines in soc.logic.helper.notifications module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 664
diff changeset
   115
  # that is probably a setting in sitesettings. (adress must be a developer). 
6e8d67d04507 Fix too long lines in soc.logic.helper.notifications module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 664
diff changeset
   116
  # This is due to a GAE limitation that allows only devs or the current user 
6e8d67d04507 Fix too long lines in soc.logic.helper.notifications module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 664
diff changeset
   117
  # to send an email. Currently this results in a user receiving the same 
6e8d67d04507 Fix too long lines in soc.logic.helper.notifications module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 664
diff changeset
   118
  # email twice.
664
fb4c825b24ab Some style fixes in soc.logic.helper.notifications module. Little changes in welcome.html template.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 641
diff changeset
   119
  
fb4c825b24ab Some style fixes in soc.logic.helper.notifications module. Little changes in welcome.html template.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 641
diff changeset
   120
  # create the message contents
640
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   121
  messageProperties = {
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   122
      'to_name': user_entity.name,
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   123
      'sender_name': current_user_entity.name,
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   124
      'to': user_entity.account.email(),
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   125
      'sender': current_user_entity.account.email(),
664
fb4c825b24ab Some style fixes in soc.logic.helper.notifications module. Little changes in welcome.html template.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 641
diff changeset
   126
      'subject': DEF_WELCOME_MSG_FMT % {
640
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   127
          'name': user_entity.name
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   128
          }
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   129
      } 
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   130
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   131
  # send out the message using the default welcome template    
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   132
  mail_dispatcher.sendMailFromTemplate('soc/mail/welcome.html', 
a62a78fe4e43 Added User welcome message.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 638
diff changeset
   133
                                       messageProperties)