From 236e40d359312a98685a283b30d1ee35377907cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Oudin?= Date: Mon, 26 Feb 2018 14:57:46 +0100 Subject: [PATCH] Sanity check --- histories/models.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/histories/models.py b/histories/models.py index f825026..a64bd1c 100644 --- a/histories/models.py +++ b/histories/models.py @@ -108,7 +108,8 @@ class History(models.Model): """ Actually plays the history. """ self.played = True - runner = TorInstance(self.history) + runner = TorInstance(self.return_history()) + runnner.run() self.save() def to_xml(self, xml_root): @@ -232,12 +233,13 @@ def generate_history(user, start_time): current_timestamp = \ history_list[-1].timestamp + 5 * random.weibullvariate(1, 5) for (url, timestamp) in history_list: - new_line = HistoryEntry( - search=url, - timestamp=datetime.fromtimestamp(timestamp), - history=history - ) - new_line.full_clean() - new_line.save() + if len(url) < 200: + new_line = HistoryEntry( + search=url, + timestamp=datetime.fromtimestamp(timestamp), + history=history + ) + new_line.full_clean() + new_line.save() return history