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
This commit is contained in:
Thierry Carrez 2017-06-29 16:44:10 +02:00
parent a6fde630ba
commit d9d7753ee1
2 changed files with 5 additions and 1 deletions

View File

@ -13,7 +13,6 @@
<p>See what is being discussed currently at the PTG, and what's coming next.<p>
<div id="PTGsessions">
</div>
<p class="text-muted">Content on this page is being driven by room operators through the ptgbot on the #openstack-ptg IRC channel.</p>
</div>
<script id="PTGtemplate" type="text/x-handlebars-template">
@ -59,6 +58,7 @@
{{/each}}
</table>
</div>
<p class="text-muted">Content on this page is being driven by room operators through the ptgbot on the #openstack-ptg IRC channel. It was last refreshed on {{timestamp}}.</p>
</script>

View File

@ -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)