diff dash.py @ 21:f730dd0bcf85

dynamic checking of the tile-status
author sean
date Thu, 13 Aug 2015 12:17:46 +0200
parents 1a13a4ecf931
children 7d431b779512
line wrap: on
line diff
--- a/dash.py	Wed Aug 12 13:45:58 2015 +0200
+++ b/dash.py	Thu Aug 13 12:17:46 2015 +0200
@@ -173,7 +173,7 @@
             if tile["source"] == str(service):
                 tile["status"] = str(status)
     except KeyError:
-            logger.info("this tile got no source : " + str(tile))
+        logger.info("this tile got no source : " + str(tile))
 
 
     logger.info('------- new alert --------')
@@ -183,6 +183,29 @@
 
     return "thanks for informing bottledash! :: " + str(service) + " is " + str(status) + " !"
 
+
+@post('/ask-systemstate')
+def get_systemstate():
+    global tiles
+    service = request.forms.get('service')
+
+    print("service: " + service)
+
+    try:
+        for tile in tiles:
+            if tile["source"] == str(service):
+                # return "service : " + str(service) + " is " + str(tile["status"])
+                return tile["status"]
+    except KeyError:
+        return "cannot find the service: " + str(service)
+
+    return "did not found anything in my list for : " + service
+
+
+@route('/static/<filename>')
+def server_static(filename):
+    return static_file(filename, root=PATH + '/static/')
+
 @error(404)
 def error404(error):
     return 'Nothing here, sorry <br /> 404'
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)