Ticket #4276: lorem_words.diff
File lorem_words.diff, 1002 bytes (added by , 18 years ago) |
---|
-
django/contrib/webdesign/lorem_ipsum.py
57 57 word_list = list(COMMON_WORDS) 58 58 else: 59 59 word_list = [] 60 c = len(word_list) 61 if count > c: 62 count = min(count - c, len(WORDS)) 63 word_list += random.sample(WORDS, count - c) 60 remaining = count - len(word_list) 61 print remaining, len(WORDS) 62 if remaining < 0: 63 word_list = word_list[:count] 64 elif remaining <= len(WORDS): 65 word_list += random.sample(WORDS, remaining) 64 66 else: 65 word_list = word_list[:count] 67 extra_words = list(WORDS * (remaining // len(WORDS))) \ 68 + random.sample(WORDS, remaining % len(WORDS)) 69 random.shuffle(extra_words) 70 word_list += extra_words 66 71 return ' '.join(word_list)