summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zielinski <tomasz.zielinski@pyconsultant.eu>2011-12-01 23:02:42 +0100
committerTomasz Zielinski <tomasz.zielinski@pyconsultant.eu>2011-12-01 23:46:02 +0100
commit031c87d57a00a41a63e771dcdfb0f09fb647afbb (patch)
treeef530cee01ab982d1653145146a6ba6815739a4b
parent21135f96641449059fa9868f5e6972cf33f368a1 (diff)
downloadaskbot-031c87d57a00a41a63e771dcdfb0f09fb647afbb.tar.gz
askbot-031c87d57a00a41a63e771dcdfb0f09fb647afbb.tar.bz2
askbot-031c87d57a00a41a63e771dcdfb0f09fb647afbb.zip
Tickets 104, 107: removed the unused/unnecessary Question methods: get_update_summary(), set_tag_names(), delete(); + removed unnecessary TODOs
-rw-r--r--askbot/models/question.py73
-rw-r--r--askbot/skins/common/media/js/live_search.js1
-rw-r--r--askbot/skins/old/media/js/live_search.js1
3 files changed, 0 insertions, 75 deletions
diff --git a/askbot/models/question.py b/askbot/models/question.py
index ad381224..52600313 100644
--- a/askbot/models/question.py
+++ b/askbot/models/question.py
@@ -689,15 +689,6 @@ class Question(content.Content):
comment.save()
return new_answer
- def delete(self):
- super(Question, self).delete()
- try:
- from askbot.conf import settings as askbot_settings
- if askbot_settings.GOOGLE_SITEMAP_CODE != '':
- ping_google()
- except Exception:
- logging.debug('problem pinging google did you register you sitemap with google?')
-
def get_answers(self, user = None):
"""returns query set for answers to this question
that may be shown to the given user
@@ -741,13 +732,6 @@ class Question(content.Content):
text = latest_revision.text
)
- def set_tag_names(self, tag_names):
- """expects some iterable of unicode string tag names
- joins the names with a space and assigns to self.tagnames
- does not save the object
- """
- self.tagnames = u' '.join(tag_names)
-
def _get_slug(self):
return slugify(self.title)
@@ -772,63 +756,6 @@ class Question(content.Content):
return when, who
- def get_update_summary(self,last_reported_at=None,recipient_email=''):
- edited = False
- if self.last_edited_at and self.last_edited_at > last_reported_at:
- if self.last_edited_by.email != recipient_email:
- edited = True
- comments = []
- for comment in self.comments.all():
- if comment.added_at > last_reported_at and comment.user.email != recipient_email:
- comments.append(comment)
- new_answers = []
- answer_comments = []
- modified_answers = []
- commented_answers = []
- import sets
- commented_answers = sets.Set([])
- for answer in self.answers.all():
- if (answer.added_at > last_reported_at and answer.author.email != recipient_email):
- new_answers.append(answer)
- if (answer.last_edited_at
- and answer.last_edited_at > last_reported_at
- and answer.last_edited_by.email != recipient_email):
- modified_answers.append(answer)
- for comment in answer.comments.all():
- if comment.added_at > last_reported_at and comment.user.email != recipient_email:
- commented_answers.add(answer)
- answer_comments.append(comment)
-
- #create the report
- from askbot.conf import settings as askbot_settings
- if edited or new_answers or modified_answers or answer_comments:
- out = []
- if edited:
- out.append(_('%(author)s modified the question') % {'author':self.last_edited_by.username})
- if new_answers:
- names = sets.Set(map(lambda x: x.author.username,new_answers))
- people = ', '.join(names)
- out.append(_('%(people)s posted %(new_answer_count)s new answers') \
- % {'new_answer_count':len(new_answers),'people':people})
- if comments:
- names = sets.Set(map(lambda x: x.user.username,comments))
- people = ', '.join(names)
- out.append(_('%(people)s commented the question') % {'people':people})
- if answer_comments:
- names = sets.Set(map(lambda x: x.user.username,answer_comments))
- people = ', '.join(names)
- if len(commented_answers) > 1:
- out.append(_('%(people)s commented answers') % {'people':people})
- else:
- out.append(_('%(people)s commented an answer') % {'people':people})
- url = askbot_settings.APP_URL + self.get_absolute_url()
- retval = '<a href="%s">%s</a>:<br>\n' % (url,self.title)
- out = map(lambda x: '<li>' + x + '</li>',out)
- retval += '<ul>' + '\n'.join(out) + '</ul><br>\n'
- return retval
- else:
- return None
-
if getattr(settings, 'USE_SPHINX_SEARCH', False):
from djangosphinx.models import SphinxSearch
Question.add_to_class(
diff --git a/askbot/skins/common/media/js/live_search.js b/askbot/skins/common/media/js/live_search.js
index 56840fcf..73e1453a 100644
--- a/askbot/skins/common/media/js/live_search.js
+++ b/askbot/skins/common/media/js/live_search.js
@@ -376,7 +376,6 @@ var liveSearch = function(){
$.each(data, function(idx, question){
var url = question['url'];
var title = question['title'];
- // TODO: `answer_count` has been transplanted from Question to Thread - this has to be updated somehow
var answer_count = question['answer_count'];
var list_item = $('<h2></h2>');
var count_element = $('<span class="item-count"></span>');
diff --git a/askbot/skins/old/media/js/live_search.js b/askbot/skins/old/media/js/live_search.js
index 09ed05e6..f9f03453 100644
--- a/askbot/skins/old/media/js/live_search.js
+++ b/askbot/skins/old/media/js/live_search.js
@@ -410,7 +410,6 @@ var liveSearch = function(){
$.each(data, function(idx, question){
var url = question['url'];
var title = question['title'];
- // TODO: `answer_count` has been transplanted from Question to Thread - this has to be updated somehow
var answer_count = question['answer_count'];
var list_item = $('<h2></h2>');
var count_element = $('<span class="item-count"></span>');