mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2026-09-27 15:56:45 +00:00
Apply suggestions from code review
Co-authored-by: dgtlmoon <leigh@morresi.net>
This commit is contained in:
@@ -208,7 +208,7 @@ class model(dict):
|
||||
if not os.path.isdir(output_path):
|
||||
os.mkdir(output_path)
|
||||
|
||||
snapshot_fname = os.path.join(output_path, "previous.txt")
|
||||
snapshot_fname = os.path.join(self.watch_data_dir, "previous.txt")
|
||||
logging.debug("Saving previous text {}".format(snapshot_fname))
|
||||
|
||||
with open(snapshot_fname, 'wb') as f:
|
||||
@@ -220,7 +220,6 @@ class model(dict):
|
||||
def get_previous_text(self):
|
||||
from os import path
|
||||
|
||||
output_path = os.path.join(self.__datastore_path, self['uuid'])
|
||||
|
||||
snapshot_fname = os.path.join(output_path, "previous.txt")
|
||||
if self.history_n < 1:
|
||||
|
||||
@@ -598,9 +598,9 @@ class ChangeDetectionStore:
|
||||
|
||||
|
||||
# Check if the previous.txt exists
|
||||
if not os.path.exists(os.path.join(self.datastore_path, uuid, "previous.txt")):
|
||||
if not os.path.exists(os.path.join(watch.watch_data_dir, "previous.txt")):
|
||||
# Generate a previous.txt
|
||||
with open(os.path.join(self.datastore_path, uuid, "previous.txt"), "wb") as f:
|
||||
with open(os.path.join(watch.watch_data_dir, "previous.txt"), "wb") as f:
|
||||
# Fill it with the latest history
|
||||
latest_file_name = watch.history[watch.newest_history_key]
|
||||
with open(latest_file_name, "rb") as f2:
|
||||
|
||||
Reference in New Issue
Block a user