mirror of https://github.com/django/django.git
Fixed #4276 -- Fixed a crash in the lorem tag when more than 20 words were
requested. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5190 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ee227a8507
commit
7c0ef82752
|
@ -59,8 +59,11 @@ def words(count, common=True):
|
|||
word_list = []
|
||||
c = len(word_list)
|
||||
if count > c:
|
||||
count = min(count - c, len(WORDS))
|
||||
word_list += random.sample(WORDS, count - c)
|
||||
count -= c
|
||||
while count > 0:
|
||||
c = min(count, len(WORDS))
|
||||
count -= c
|
||||
word_list += random.sample(WORDS, c)
|
||||
else:
|
||||
word_list = word_list[:count]
|
||||
return ' '.join(word_list)
|
||||
|
|
Loading…
Reference in New Issue