Просмотр исходного кода

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

rafalp 6 лет назад
Родитель
Сommit
86d9e51b44
1 измененных файлов с 5 добавлено и 1 удалено
  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="-",
         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()
 
     return thread