load new version

This commit is contained in:
j 2014-09-05 19:02:19 +02:00
parent 0ef522f620
commit 1e9a1ef4ef
1 changed files with 11 additions and 2 deletions

View File

@ -5,6 +5,7 @@ from __future__ import division, print_function
import os import os
import sys import sys
import signal import signal
import time
from tornado.httpserver import HTTPServer from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop from tornado.ioloop import IOLoop
@ -12,7 +13,7 @@ from tornado.web import StaticFileHandler, Application
from cache import Cache from cache import Cache
from item.handlers import EpubHandler, ReaderHandler, FileHandler from item.handlers import EpubHandler, ReaderHandler, FileHandler
from item.handlers import OMLHandler, serve_static from item.handlers import OMLHandler
from item.icons import IconHandler from item.icons import IconHandler
import db import db
import node.server import node.server
@ -29,7 +30,15 @@ class MainHandler(OMLHandler):
def get(self, path): def get(self, path):
path = os.path.join(settings.static_path, 'html/oml.html') path = os.path.join(settings.static_path, 'html/oml.html')
serve_static(self, path, 'text/html') with open(path) as fd:
content = fd.read()
version = settings.MINOR_VERSION
if version == 'git':
version = int(time.mktime(time.gmtime()))
content = content.replace('oml.js?1', 'oml.js?%s' % version)
self.set_header('Content-Type', 'text/html')
self.set_header('Content-Length', str(len(content)))
self.write(content)
def run(): def run():
setup.create_db() setup.create_db()