diff web/templog.py @ 182:e731c0d30b09

set nearly working
author Matt Johnston <matt@ucc.asn.au>
date Tue, 04 Feb 2014 22:49:16 +0800
parents 3b4277aaed3c
children adbf70d1449f
line wrap: on
line diff
--- a/web/templog.py	Thu Jan 30 22:56:17 2014 +0800
+++ b/web/templog.py	Tue Feb 04 22:49:16 2014 +0800
@@ -8,6 +8,7 @@
 import time
 import urllib
 import sys
+import os
 
 import bottle
 from bottle import route, request, response
@@ -44,6 +45,15 @@
     start_epoch = time.mktime(start.timetuple())
     return log.graph_png(start_epoch, length_minutes * 60)
 
+@route('/set')
+def set():
+    return bottle.template('set', inline_data = log.get_params())
+
+@route('/set_current.json')
+def set_fresh():
+    response.set_header('Content-Type', 'application/javascript')
+    return log.get_current()
+
 @route('/')
 def top():
 
@@ -87,6 +97,20 @@
     response.set_header('Content-Type', 'text/plain')
     return log.tail_debug_log()
 
+@route('/env')
+def env():
+    response.set_header('Content-Type', 'text/plain')
+    return '\n'.join(("%s %s" % k) for k in  request.environ.items())
+    #return str(request.environ)
+    #yield "\n"
+    #var_lookup = environ['mod_ssl.var_lookup']
+    #return var_lookup("SSL_SERVER_I_DN_O")
+
[email protected]('/<filename:re:.*\.js>')
+def javascripts(filename):
+    return bottle.static_file(filename, root='static')
+
+
 def main():
     #bottle.debug(True)
     #bottle.run(reloader=True)