commit 5f704b845654cb883bdb05460bafa9543d9c4846
Author: Tom Ritter <tom(a)ritter.vg>
Date: Thu Apr 2 17:57:43 2015 -0400
Correctly remove files older than the given time period
---
website.py | 2 +-
write_website.py | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/website.py b/website.py
index fa7bb8e..668f6eb 100755
--- a/website.py
+++ b/website.py
@@ -992,4 +992,4 @@ if __name__ == '__main__':
w.write_website(os.path.join(os.path.dirname(__file__), 'out', \
'consensus-health-' + w.get_consensus_time().strftime("%Y-%m-%d-%H-%M") + '.html'), True)
w.write_website(os.path.join(os.path.dirname(__file__), 'out', 'consensus-health.html'), True)
- w.write_website(os.path.join(os.path.dirname(__file__), 'out', 'index.html'), False)
\ No newline at end of file
+ w.write_website(os.path.join(os.path.dirname(__file__), 'out', 'index.html'), False)
diff --git a/write_website.py b/write_website.py
index 6fe9089..9346d3e 100755
--- a/write_website.py
+++ b/write_website.py
@@ -88,10 +88,10 @@ def main():
files = [f for f in os.listdir(os.path.join(os.path.dirname(__file__), 'out'))]
for f in files:
if f.startswith("consensus-health-"):
- f = f.replace("consensus-health-", "").replace(".html", "").replace(".gz", "")
- f_time = datetime.datetime.strptime(f, "%Y-%m-%d-%H-%M")
+ f_time = f.replace("consensus-health-", "").replace(".html", "").replace(".gz", "")
+ f_time = datetime.datetime.strptime(f_time, "%Y-%m-%d-%H-%M")
if (consensus_time - f_time).days > weeks_to_keep * 7:
- os.remove(f)
+ os.remove(os.path.join(os.path.dirname(__file__), 'out', f))
def get_consensuses():