Browse Source

Fix #1200: fake thread's slug could be empty

rafalp 6 years ago
parent
commit
86d9e51b44
1 changed files with 5 additions and 1 deletions
  1. 5 1
      misago/faker/threads.py

+ 5 - 1
misago/faker/threads.py

@@ -49,7 +49,11 @@ def _create_base_thread(fake, category):
         last_poster_slug="-",
         last_poster_slug="-",
         replies=0,
         replies=0,
     )
     )
-    thread.set_title(corpus_short.random_sentence())
+
+    # Sometimes thread ends with slug being set to empty string
+    while not thread.slug:
+        thread.set_title(corpus_short.random_sentence())
+
     thread.save()
     thread.save()
 
 
     return thread
     return thread