diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-05-16 01:20:05 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-05-16 01:20:05 -0400 |
commit | d43de82ff1167bef372933dafebd8c19b47acf06 (patch) | |
tree | 20f45d57cec41e2f532de047dbf6c56b1db8a88e | |
parent | 68883de9a3f294d3dfa7e59e6a8765c341d710a5 (diff) | |
download | askbot-d43de82ff1167bef372933dafebd8c19b47acf06.tar.gz askbot-d43de82ff1167bef372933dafebd8c19b47acf06.tar.bz2 askbot-d43de82ff1167bef372933dafebd8c19b47acf06.zip |
added another signal - new_comment_posted, in hindsight maybe we should have had just one "new_post_created" instead of the three separate ones
-rw-r--r-- | askbot/models/signals.py | 3 | ||||
-rw-r--r-- | askbot/views/writers.py | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/askbot/models/signals.py b/askbot/models/signals.py index 4104ec62..42a9c787 100644 --- a/askbot/models/signals.py +++ b/askbot/models/signals.py @@ -31,6 +31,9 @@ new_answer_posted = django.dispatch.Signal( new_question_posted = django.dispatch.Signal( providing_args=['question', 'user', 'form_data'] ) +new_comment_posted = django.dispatch.Signal( + providing_args=['comment', 'user', 'form_data'] +) answer_edited = django.dispatch.Signal( providing_args=['answer', 'user', 'form_data'] ) diff --git a/askbot/views/writers.py b/askbot/views/writers.py index 8379ba82..9890e579 100644 --- a/askbot/views/writers.py +++ b/askbot/views/writers.py @@ -720,9 +720,14 @@ def post_comments(request):#generic ajax handler to load comments to an object '<a href="%(sign_in_url)s">sign in</a>.') % \ {'sign_in_url': url_utils.get_login_url()} raise exceptions.PermissionDenied(msg) - user.post_comment( + comment = user.post_comment( parent_post=post, body_text=form.cleaned_data['comment'] ) + signals.new_comment_posted.send(None, + comment=comment, + user=user, + form_data=form.cleaned_data + ) response = __generate_comments_json(post, user) except exceptions.PermissionDenied, e: response = HttpResponseForbidden(unicode(e), mimetype="application/json") |