diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-10-08 23:12:37 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-10-08 23:12:37 -0400 |
commit | e80e9bde56efebc17e4ede78b10f5207d030872f (patch) | |
tree | 6b48a3a5bb5f668fe39d4417766fd11be6bf8537 | |
parent | 2696371833aa1ccbf263d191b2c849203e3a3981 (diff) | |
download | askbot-e80e9bde56efebc17e4ede78b10f5207d030872f.tar.gz askbot-e80e9bde56efebc17e4ede78b10f5207d030872f.tar.bz2 askbot-e80e9bde56efebc17e4ede78b10f5207d030872f.zip |
fixed bug with edit of post containing a mention
-rw-r--r-- | askbot/models/base.py | 2 | ||||
-rw-r--r-- | askbot/models/user.py | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/askbot/models/base.py b/askbot/models/base.py index dcd94ab9..2ef874d6 100644 --- a/askbot/models/base.py +++ b/askbot/models/base.py @@ -78,6 +78,8 @@ def parse_post_text(post): for prev_mention in prev_mention_qs: user = prev_mention.get_mentioned_user() + if user is None: + continue if user in new_set: #don't report mention twice new_set.remove(user) diff --git a/askbot/models/user.py b/askbot/models/user.py index 571f3867..f0a34551 100644 --- a/askbot/models/user.py +++ b/askbot/models/user.py @@ -158,7 +158,10 @@ class Activity(models.Model): def get_mentioned_user(self): assert(self.activity_type == const.TYPE_ACTIVITY_MENTION) user_qs = self.receiving_users.all() - assert(len(user_qs) == 1) + user_count = len(user_qs) + if user_count == 0: + return None + assert(user_count == 1) return user_qs[0] def get_absolute_url(self): |