More generic code using @8f4458b

This commit is contained in:
Rémi Oudin 2018-02-21 11:50:28 +01:00
parent 8f4458b009
commit cd4d8a4c3f

View file

@ -78,17 +78,9 @@ def generate_first_url(user):
]
)
search_term = random.choice(interset)
if isinstance(search_term, profiles.Website):
if user.uses_url:
url = search_term.url
elif random.random() <= 0.1:
url = random.choice(search_term.notable_pages).url
elif random.random() >= 0.3:
search_term_text = search_term.name + " " + random.choice(search_term.keywords)
url = user.search_engine.search_url(search_term_text)
#if
#elif isinstance(search_term, profiles.Website):
# url = user.search_engine.search_url(search_term)
url = search_term.generate_url(user)
return url