summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--askbot/models/question.py3
-rw-r--r--askbot/tests/db_api_tests.py7
2 files changed, 10 insertions, 0 deletions
diff --git a/askbot/models/question.py b/askbot/models/question.py
index 3453ff7c..3e8d2267 100644
--- a/askbot/models/question.py
+++ b/askbot/models/question.py
@@ -722,6 +722,9 @@ class Thread(models.Model):
*IMPORTANT*: self._question_post() has to exist when update_tags() is called!
"""
+ if tagnames.strip() == '':
+ return
+
previous_tags = list(self.tags.all())
previous_tagnames = set([tag.name for tag in previous_tags])
diff --git a/askbot/tests/db_api_tests.py b/askbot/tests/db_api_tests.py
index 3a0c9582..55cf0ef9 100644
--- a/askbot/tests/db_api_tests.py
+++ b/askbot/tests/db_api_tests.py
@@ -46,6 +46,13 @@ class DBApiTests(AskbotTestCase):
self.assertTrue(post.deleted_by == None)
self.assertTrue(post.deleted_at == None)
+ def test_blank_tags_impossible(self):
+ self.post_question(tags='')
+ self.assertEqual(
+ models.Tag.objects.filter(name='').count(),
+ 0
+ )
+
def test_flag_question(self):
self.user.set_status('m')
self.user.flag_post(self.question)