taskapp/utilities/notification.py
changeset 141 2489392ffb56
parent 133 34187a80d279
child 142 bd65e2c9a7b4
equal deleted inserted replaced
140:7bdcbb4f2c27 141:2489392ffb56
    69                 notification.message += "Remarks: %s<br />"%remarks
    69                 notification.message += "Remarks: %s<br />"%remarks
    70 
    70 
    71     elif role in ["DV", "MG", "AD"]:
    71     elif role in ["DV", "MG", "AD"]:
    72 
    72 
    73         accepting_user = sent_from
    73         accepting_user = sent_from
    74         user_url = "/user/view/uid=%s"%(accepting_user.id) ## 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 = "/user/view/uid=%s"%(requested_by.id)
    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 
    78 
    79         if reply:
    79         if reply:
    80             notification.sub = "New %s for the site"%role_rights
    80             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)
    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         else:
    82         else:
    83             notification.sub = "Rejected your request to act as %s"%role_rights
    83             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)
    84             notification.message = "%s has rejected your request asking him to act as a %s.<br />"%(new_mentor_url, task_url)
    85             if remarks:
    85             if remarks:
    86                 notification.message += "Remarks: %s<br />"%remarks
    86                 notification.message += "Remarks: %s<br />"%remarks