Mercurial > bottledash
comparison 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 |
comparison
equal
deleted
inserted
replaced
20:1a13a4ecf931 | 21:f730dd0bcf85 |
---|---|
171 try: | 171 try: |
172 for tile in tiles: | 172 for tile in tiles: |
173 if tile["source"] == str(service): | 173 if tile["source"] == str(service): |
174 tile["status"] = str(status) | 174 tile["status"] = str(status) |
175 except KeyError: | 175 except KeyError: |
176 logger.info("this tile got no source : " + str(tile)) | 176 logger.info("this tile got no source : " + str(tile)) |
177 | 177 |
178 | 178 |
179 logger.info('------- new alert --------') | 179 logger.info('------- new alert --------') |
180 logger.info('Service : ' + str(service)) | 180 logger.info('Service : ' + str(service)) |
181 logger.info('Status : ' + str(status)) | 181 logger.info('Status : ' + str(status)) |
182 log_tile_status() | 182 log_tile_status() |
183 | 183 |
184 return "thanks for informing bottledash! :: " + str(service) + " is " + str(status) + " !" | 184 return "thanks for informing bottledash! :: " + str(service) + " is " + str(status) + " !" |
185 | 185 |
186 | |
187 @post('/ask-systemstate') | |
188 def get_systemstate(): | |
189 global tiles | |
190 service = request.forms.get('service') | |
191 | |
192 print("service: " + service) | |
193 | |
194 try: | |
195 for tile in tiles: | |
196 if tile["source"] == str(service): | |
197 # return "service : " + str(service) + " is " + str(tile["status"]) | |
198 return tile["status"] | |
199 except KeyError: | |
200 return "cannot find the service: " + str(service) | |
201 | |
202 return "did not found anything in my list for : " + service | |
203 | |
204 | |
205 @route('/static/<filename>') | |
206 def server_static(filename): | |
207 return static_file(filename, root=PATH + '/static/') | |
208 | |
186 @error(404) | 209 @error(404) |
187 def error404(error): | 210 def error404(error): |
188 return 'Nothing here, sorry <br /> 404' | 211 return 'Nothing here, sorry <br /> 404' |
189 | 212 |
190 read_config() | 213 read_config() |