summaryrefslogtreecommitdiffstats
path: root/askbot/models/base.py
diff options
context:
space:
mode:
authorAdolfo Fitoria <adolfo.fitoria@gmail.com>2011-08-08 17:06:00 -0400
committerAdolfo Fitoria <adolfo.fitoria@gmail.com>2011-08-08 17:06:00 -0400
commitc45c3697152598f5fe46e0d6dd54f039e562c79f (patch)
treeccabc1af9d223caa6318bfc2a6c983d1bccf0aaf /askbot/models/base.py
parent1bfc46f91b7f2e3e2f8573ab335f07bd685e3df8 (diff)
downloadaskbot-c45c3697152598f5fe46e0d6dd54f039e562c79f.tar.gz
askbot-c45c3697152598f5fe46e0d6dd54f039e562c79f.tar.bz2
askbot-c45c3697152598f5fe46e0d6dd54f039e562c79f.zip
kinda fixing inbox
Diffstat (limited to 'askbot/models/base.py')
-rw-r--r--askbot/models/base.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/askbot/models/base.py b/askbot/models/base.py
index 361ae5df..3af19318 100644
--- a/askbot/models/base.py
+++ b/askbot/models/base.py
@@ -8,6 +8,7 @@ from django.contrib.contenttypes.models import ContentType
from django.contrib.sitemaps import ping_google
#todo: maybe merge askbot.utils.markup and forum.utils.html
from askbot.utils import markup
+from askbot.utils.diff import textDiff
from askbot.utils.html import sanitize_html
from django.utils import html
import logging
@@ -124,7 +125,15 @@ def parse_and_save_post(post, author = None, **kwargs):
#this save must precede saving the mention activity
#because generic relation needs primary key of the related object
- super(post.__class__, post).save(**kwargs)
+ if post.post_type != 'comment':
+ last_revision = post.get_latest_revision().as_html()
+ super(post.__class__, post).save(**kwargs)
+ current_revision = post.get_latest_revision().as_html()
+ diff = textDiff(current_revision, last_revision)
+ else:
+ #we get comments
+ super(post.__class__, post).save(**kwargs)
+ diff = None
timestamp = post.get_time_of_last_edit()
@@ -147,6 +156,7 @@ def parse_and_save_post(post, author = None, **kwargs):
newly_mentioned_users = newly_mentioned_users,
timestamp = timestamp,
created = created,
+ diff = diff,
sender = post.__class__
)
@@ -238,6 +248,9 @@ class ContentRevision(models.Model):
"""
raise NotImplementedError()
+ def get_snipet(self):
+ pass
+
class AnonymousContent(models.Model):
"""