taskapp/utilities/notification.py
changeset 142 bd65e2c9a7b4
parent 141 2489392ffb56
child 144 581ad20b8c39
equal deleted inserted replaced
141:2489392ffb56 142:bd65e2c9a7b4
    73         accepting_user = sent_from
    73         accepting_user = sent_from
    74         user_url = '<a href="/user/view/uid=%s">%s</a>'%(accepting_user.id, accepting_user.username) ## i mean the user who has accepted it
    74         user_url = '<a href="/user/view/uid=%s">%s</a>'%(accepting_user.id, accepting_user.username) ## i mean the user who has accepted it
    75         requested_by_url = '<a href="/user/view/uid=%s">%s</a>'%(requested_by.id, requested_by.username)
    75         requested_by_url = '<a href="/user/view/uid=%s">%s</a>'%(requested_by.id, requested_by.username)
    76         role_rights = dict(RIGHTS_CHOICES)[role]
    76         role_rights = dict(RIGHTS_CHOICES)[role]
    77         role_learn_url = "/about/%s"%role_rights.lower()
    77         role_learn_url = "/about/%s"%role_rights.lower()
       
    78         a_or_an = "an" if role_rights == "AD" else "a"
    78 
    79 
    79         if reply:
    80         if reply:
    80             notification.sub = "New %s for the site"%role_rights
    81             notification.sub = "New %s for the site"%role_rights
    81             notification.message = "%s has accepted request made by %s asking him to act as a %s for the website.<br />"%(user_url, requested_by_url, role_rights)
    82             notification.message = "%s has accepted request made by %s asking him to act as %s %s for the website.<br />"%(user_url, requested_by_url, a_or_an, role_rights)
    82         else:
    83         else:
    83             notification.sub = "Rejected your request to act as %s"%role_rights
    84             notification.sub = "Rejected your request to act as %s"%role_rights
    84             notification.message = "%s has rejected your request asking him to act as a %s.<br />"%(new_mentor_url, task_url)
    85             notification.message = "%s has rejected your request asking him to act as a %s.<br />"%(new_mentor_url, task_url)
    85             if remarks:
    86             if remarks:
    86                 notification.message += "Remarks: %s<br />"%remarks
    87                 notification.message += "Remarks: %s<br />"%remarks