diff options
author | Adolfo Fitoria <adolfo.fitoria@gmail.com> | 2011-08-10 12:14:53 -0400 |
---|---|---|
committer | Adolfo Fitoria <adolfo.fitoria@gmail.com> | 2011-08-10 12:14:53 -0400 |
commit | d5b1f0c035616f6d99e863476d5754193280ba75 (patch) | |
tree | d1353baac400891a8399fe2a7e56d51655048c70 | |
parent | 0323a45504087bca852bc1171972e4380661b756 (diff) | |
download | askbot-d5b1f0c035616f6d99e863476d5754193280ba75.tar.gz askbot-d5b1f0c035616f6d99e863476d5754193280ba75.tar.bz2 askbot-d5b1f0c035616f6d99e863476d5754193280ba75.zip |
fixed bug
-rw-r--r-- | askbot/models/base.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/askbot/models/base.py b/askbot/models/base.py index 53d5918b..58bf9ad3 100644 --- a/askbot/models/base.py +++ b/askbot/models/base.py @@ -107,6 +107,7 @@ def parse_and_save_post(post, author = None, **kwargs): assert(author is not None) + last_revision = post.html data = post.parse() post.html = data['html'] @@ -125,15 +126,11 @@ 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 - if post.post_type != 'comment': - last_revision = post.revisions.all().order_by('-revised_at')[1].as_html(include_tags=False) - super(post.__class__, post).save(**kwargs) - current_revision = post.get_latest_revision().as_html(include_tags=False) - diff = htmldiff(last_revision, current_revision) + super(post.__class__, post).save(**kwargs) + if last_revision: + diff = htmldiff(last_revision, post.html) else: - #we get comments - super(post.__class__, post).save(**kwargs) - diff = None + diff = post.get_snippet() timestamp = post.get_time_of_last_edit() |