From d9d7753ee13061c26dec9d01c14cad8bebd095a5 Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Thu, 29 Jun 2017 16:44:10 +0200 Subject: [PATCH] Refresh at startup and add refresh timestamp Add a refresh timestamp, and generate the page at startup (to pick up recent ethercalc changes). Change-Id: I1fec2e29cabf434e0aa4466d426ce7f1777198b4 --- html/ptg.html | 2 +- ptgbot/db.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/html/ptg.html b/html/ptg.html index 1fe12d3..eb41047 100644 --- a/html/ptg.html +++ b/html/ptg.html @@ -13,7 +13,6 @@

See what is being discussed currently at the PTG, and what's coming next.

-

Content on this page is being driven by room operators through the ptgbot on the #openstack-ptg IRC channel.

diff --git a/ptgbot/db.py b/ptgbot/db.py index e3387ee..1a0ee2c 100644 --- a/ptgbot/db.py +++ b/ptgbot/db.py @@ -16,6 +16,7 @@ import json import os +import datetime class PTGDataBase(): @@ -30,6 +31,7 @@ class PTGDataBase(): self.data = json.load(fp) else: self.data = self.BASE + self.save() def add_now(self, room, session): self.data['now'][room] = session @@ -76,5 +78,7 @@ class PTGDataBase(): def save(self): if self.ethercalc: self.data['ethercalc'] = self.ethercalc.load() + timestamp = datetime.datetime.now() + self.data['timestamp'] = '{:%Y-%m-%d %H:%M:%S}'.format(timestamp) with open(self.filename, 'w') as fp: json.dump(self.data, fp)