app/soc/logic/helper/notifications.py
changeset 2319 3eee2308f1dd
parent 2171 83d96aadd228
child 2360 e389d26949db
equal deleted inserted replaced
2318:594b55099fab 2319:3eee2308f1dd
   189       'scope': to_user,
   189       'scope': to_user,
   190       'link_id': 't%i' % (int(time.time()*100)),
   190       'link_id': 't%i' % (int(time.time()*100)),
   191       'scope_path': to_user.link_id
   191       'scope_path': to_user.link_id
   192   }
   192   }
   193 
   193 
       
   194   import soc.logic.models.notification
   194   key_name = model_logic.notification.logic.getKeyNameFromFields(fields)
   195   key_name = model_logic.notification.logic.getKeyNameFromFields(fields)
   195 
   196 
   196   # create and put a new notification in the datastore
   197   # create and put a new notification in the datastore
   197   model_logic.notification.logic.updateOrCreateFromKeyName(fields, key_name)
   198   model_logic.notification.logic.updateOrCreateFromKeyName(fields, key_name)
   198 
   199 
   201   """Sends an email to a user about a new notification.
   202   """Sends an email to a user about a new notification.
   202 
   203 
   203     Args:
   204     Args:
   204       notification_entity: Notification about which the message should be sent
   205       notification_entity: Notification about which the message should be sent
   205   """
   206   """
       
   207 
       
   208   import soc.views.models.notification
   206 
   209 
   207   # create the url to show this notification
   210   # create the url to show this notification
   208   notification_url = "http://%(host)s%(index)s" % {
   211   notification_url = "http://%(host)s%(index)s" % {
   209       'host' : os.environ['HTTP_HOST'],
   212       'host' : os.environ['HTTP_HOST'],
   210       'index': redirects.getPublicRedirect(notification_entity,
   213       'index': redirects.getPublicRedirect(notification_entity,