|
|
@ -3,8 +3,10 @@
|
|
|
|
import random
|
|
|
|
import random
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WORDLIST = "/usr/share/dict/words"
|
|
|
|
LOREM = """Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sit amet nulla id mi imperdiet condimentum. \
|
|
|
|
STATIC_TEXT = "I have been Shreddited for privacy!"
|
|
|
|
Vestibulum ac consequat lorem, eu tempus felis. Maecenas eget purus in nisi blandit volutpat. Aenean \
|
|
|
|
|
|
|
|
bibendum eros sit amet ex rhoncus, eu porta magna sodales. Sed venenatis sapien sit amet tempor euismod. \
|
|
|
|
|
|
|
|
Ut a neque purus. Vestibulum quis tortor non leo eleifend interdum."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
@ -16,9 +18,6 @@ except ImportError:
|
|
|
|
replacement. The current solution is to return a static text string unless the operating system has a word list.
|
|
|
|
replacement. The current solution is to return a static text string unless the operating system has a word list.
|
|
|
|
If that is the case, use it instead.
|
|
|
|
If that is the case, use it instead.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
try:
|
|
|
|
words = LOREM.split()
|
|
|
|
lines = [line.strip() for line in open(WORDLIST).readlines()]
|
|
|
|
random.shuffle(words)
|
|
|
|
return " ".join(random.sample(lines, random.randint(50, 150)))
|
|
|
|
return " ".join(words)
|
|
|
|
except IOError:
|
|
|
|
|
|
|
|
# The word list wasn't available...
|
|
|
|
|
|
|
|
return STATIC_TEXT
|
|
|
|
|
|
|
|