From e2221760ba5bca8c0157da826198783e8fe244bc Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sun, 26 Jun 2011 19:23:04 -0400 Subject: incremented version and fixed a bug on comment edit --- askbot/__init__.py | 2 +- askbot/models/meta.py | 4 ++-- askbot/tests/db_api_tests.py | 2 +- askbot/views/writers.py | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/askbot/__init__.py b/askbot/__init__.py index 9291023f..38d56af5 100644 --- a/askbot/__init__.py +++ b/askbot/__init__.py @@ -9,7 +9,7 @@ import smtplib import sys import logging -VERSION = (0, 7, 2) +VERSION = (0, 7, 3) #necessary for interoperability of django and coffin try: diff --git a/askbot/models/meta.py b/askbot/models/meta.py index 0db36ab3..7cccbcd6 100644 --- a/askbot/models/meta.py +++ b/askbot/models/meta.py @@ -301,9 +301,9 @@ class Comment(base.MetaContent, base.UserContent): what_to_count = { 'user': user, 'object_id': self.id, - 'content_type': self.content_type + 'content_type': content_type } - return Vote.objects.count(**what_to_count) > 0 + return Vote.objects.filter(**what_to_count).count() > 0 def is_last(self): """True if there are no newer comments on diff --git a/askbot/tests/db_api_tests.py b/askbot/tests/db_api_tests.py index 18fc174b..00091934 100644 --- a/askbot/tests/db_api_tests.py +++ b/askbot/tests/db_api_tests.py @@ -368,7 +368,7 @@ class CommentTests(AskbotTestCase): comments = self.question.get_comments(visitor = self.other_user) self.assertEquals(len(comments), 1) self.assertEquals(comments[0].upvoted_by_user, True) - + self.assertEquals(comments[0].is_upvoted_by(self.other_user), True) def test_other_user_can_cancel_upvote(self): self.test_other_user_can_upvote_comment() diff --git a/askbot/views/writers.py b/askbot/views/writers.py index c5a69c1d..bb49c971 100644 --- a/askbot/views/writers.py +++ b/askbot/views/writers.py @@ -586,6 +586,8 @@ def post_comments(request):#generic ajax handler to load comments to an object @decorators.ajax_only def edit_comment(request): + import pdb + pdb.set_trace() if request.user.is_authenticated(): comment_id = int(request.POST['comment_id']) comment = models.Comment.objects.get(id = comment_id) -- cgit v1.2.3-1-g7c22