mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2026-09-29 08:46:45 +00:00
tweaks
This commit is contained in:
@@ -850,14 +850,14 @@ def changedetection_app(config=None, datastore_o=None):
|
||||
# Read as binary and force decode as UTF-8
|
||||
# Windows may fail decode in python if we just use 'r' mode (chardet decode exception)
|
||||
try:
|
||||
newest_version_file_contents = watch.get_history_snapshot(history[dates[-1]])
|
||||
newest_version_file_contents = watch.get_history_snapshot(dates[-1])
|
||||
except Exception as e:
|
||||
newest_version_file_contents = "Unable to read {}.\n".format(history[dates[-1]])
|
||||
newest_version_file_contents = "Unable to read {}.\n".format(dates[-1])
|
||||
|
||||
previous_version = request.args.get('previous_version')
|
||||
previous_timestamp = history[dates[-2]]
|
||||
previous_timestamp = dates[-2]
|
||||
if previous_version:
|
||||
previous_timestamp= previous_version
|
||||
previous_timestamp = previous_version
|
||||
|
||||
try:
|
||||
previous_version_file_contents = watch.get_history_snapshot(previous_timestamp)
|
||||
|
||||
@@ -241,6 +241,10 @@ class model(dict):
|
||||
bump = self.history
|
||||
return self.__newest_history_key
|
||||
|
||||
def get_history_snapshot(self, timestamp):
|
||||
with open(self.history[timestamp], 'r', encoding='utf-8', errors='ignore') as f:
|
||||
return f.read()
|
||||
|
||||
# Save some text file to the appropriate path and bump the history
|
||||
# result_obj from fetch_site_status.run()
|
||||
def save_history_text(self, contents, timestamp, snapshot_id):
|
||||
@@ -359,9 +363,6 @@ class model(dict):
|
||||
return fname
|
||||
return False
|
||||
|
||||
def get_history_snapshot(self, timestamp):
|
||||
with open(self.history[timestamp], 'rb', encoding='utf-8', errors='ignore') as f:
|
||||
return f.read()
|
||||
|
||||
def pause(self):
|
||||
self['paused'] = True
|
||||
|
||||
Reference in New Issue
Block a user