def on_asset_posted(sender, instance, created, **kwargs):
print("on_asset_posted: instance={}, created={}".format(instance, created))
asset = instance
Event.process(asset, None, created)
# @receiver(notify)
# def on_notify(verb, recipient, sender, **kwargs):
# print("Notify {0} about {1} {2}".format(recipient.email, sender, verb))
# subject = None
# body = None
# template = None
# if isinstance(sender, Comment):
# comment = sender
# # asset = sender.content_object
# # if verb == 'was posted' and recipient.profile.email_comments:
# # subject =
# # template = loader.get_template('assets/notification/new_comment_posted.txt')
# # elif verb == 'mentioned' and recipient.profile.email_mention:
# # subject =
# # template = loader.get_template('assets/notification/mention.txt')
# # if template:
# # context = dict(comment=comment, asset=asset, user=recipient)
# # body = template.render(context)
#
# if isinstance(sender, Asset):
# asset = sender
# # if verb == 'was posted' and recipient.profile.email_assets:
# # subject =
# # template = loader.get_template('assets/notification/new_asset_posted.txt')
# # elif verb == 'was updated' and recipient.profile.email_assets:
# # subject =
# # template = loader.get_template('assets/notification/asset_updated.txt')
# # elif verb == 'mentioned' and recipient.profile.email_mention:
# # subject = ugettext("[{site}]: You were mentioned").format(site = comment.site.name)
# # template = loader.get_template('assets/notification/mention.txt')
# # if template:
# # context = dict(asset=asset, user=recipient)
# # body = template.render(context)
#
# if subject and body:
# send_mail(subject, body, settings.DEFAULT_FROM_EMAIL, [recipient.email], fail_silently = False)
评论列表
文章目录