def notify(notification):
if not notification.data:
return "invalid notification"
template_name = notification.data.get('template', None)
if not template_name:
return unicode(notification.data)
try:
template = get_template(join('assets', 'notification', template_name))
context = dict(notice=notification, user=notification.recipient, instance=notification.action_object, parent=notification.target, author=notification.actor)
return template.render(context)
except TemplateDoesNotExist:
return "template does not exist: " + template_name
评论列表
文章目录