def task_notify(form):
 vars = form.vars
 pe_id = vars.pe_id
 if (not pe_id):
  return
 user = current.auth.user
 if (user and (user.pe_id == pe_id)):
  return
 if (int(vars.status) not in current.response.s3.project_task_active_statuses):
  return
 if ((form.record is None) or (int(pe_id) != form.record.pe_id)):
  settings = current.deployment_settings
  if settings.has_module('msg'):
   subject = ('%s: Task assigned to you' % settings.get_system_name_short())
   url = ('%s%s' % (settings.get_base_public_url(), URL(c='project', f='task', args=vars.id)))
   priority = current.s3db.project_task.priority.represent(int(vars.priority))
   message = ('You have been assigned a Task:\n\n%s\n\n%s\n\n%s\n\n%s' % (url, ('%s priority' % priority), vars.name, (vars.description or '')))
   current.msg.send_by_pe_id(pe_id, subject, message)
 return

def task_notify ( form ) : vars = form . vars pe_id = vars . pe_id if ( not pe_id ) : return user = current . auth . user if ( user and ( user . pe_id == pe_id ) ) : return if ( int ( vars . status ) not in current . response . s3 . project_task_active_statuses ) : return if ( ( form . record is None ) or ( int ( pe_id ) != form . record . pe_id ) ) : settings = current . deployment_settings if settings . has_module ( 'msg' ) : subject = ( '%s: Task assigned to you' % settings . get_system_name_short ( ) ) url = ( '%s%s' % ( settings . get_base_public_url ( ) , URL ( c = 'project' , f = 'task' , args = vars . id ) ) ) priority = current . s3db . project_task . priority . represent ( int ( vars . priority ) ) message = ( 'You have been assigned a Task:\n\n%s\n\n%s\n\n%s\n\n%s' % ( url , ( '%s priority' % priority ) , vars . name , ( vars . description or '' ) ) ) current . msg . send_by_pe_id ( pe_id , subject , message ) return
if the task is assigned to someone then notify them .