From da20707172cce592c61ae455a8a89190fb012c92 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Wed, 2 May 2012 18:28:20 -0400 Subject: fix to asking by email and another one to prevent creation of "blank" tags --- askbot/lamson_handlers.py | 6 ++++-- askbot/models/question.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/askbot/lamson_handlers.py b/askbot/lamson_handlers.py index 1d4bb1bc..34f93a7b 100644 --- a/askbot/lamson_handlers.py +++ b/askbot/lamson_handlers.py @@ -114,9 +114,11 @@ def get_parts(message): parts.append((part_type, part_content)) return parts -@route('(addr)@(host)') +@route('(addr)@(host)', addr = '.+') @stateless def ASK(message, host = None, addr = None): + if addr.startswith('reply-'): + return parts = get_parts(message) from_address = message.From subject = message['Subject']#why lamson does not give it normally? @@ -128,7 +130,7 @@ def ASK(message, host = None, addr = None): try: group_tag = Tag.group_tags.get( deleted = False, - name = addr + name_iexact = addr ) mail.process_emailed_question( from_address, subject, parts, tags = [group_tag.name, ] diff --git a/askbot/models/question.py b/askbot/models/question.py index 9481d3ac..4e590d94 100644 --- a/askbot/models/question.py +++ b/askbot/models/question.py @@ -676,7 +676,7 @@ class Thread(models.Model): previous_tags = list(self.tags.all()) previous_tagnames = set([tag.name for tag in previous_tags]) - updated_tagnames = set(t for t in tagnames.split(' ')) + updated_tagnames = set(t for t in tagnames.strip().split(' ')) removed_tagnames = previous_tagnames - updated_tagnames added_tagnames = updated_tagnames - previous_tagnames @@ -751,7 +751,7 @@ class Thread(models.Model): thread_question = self._question_post() - self.tagnames = tagnames + self.tagnames = tagnames.strip() self.save() # Update the Question itself -- cgit v1.2.3-1-g7c22