Mercurial > templog
comparison web/templog.py @ 62:68c1e2b26bc5
merge
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 26 Jun 2012 21:21:09 +0800 |
parents | 62112fc2af21 |
children | a8ff20f15734 |
comparison
equal
deleted
inserted
replaced
60:2ebe33714989 | 62:68c1e2b26bc5 |
---|---|
38 start_hour = datetime.datetime.strptime(request.query.hour, '%Y%m%d%H') | 38 start_hour = datetime.datetime.strptime(request.query.hour, '%Y%m%d%H') |
39 else: | 39 else: |
40 start_hour = datetime.datetime.now() - datetime.timedelta(days=1) | 40 start_hour = datetime.datetime.now() - datetime.timedelta(days=1) |
41 | 41 |
42 start = time.mktime(start_hour.timetuple()) | 42 start = time.mktime(start_hour.timetuple()) |
43 length = int(request.query.get('length', 36)) * 3600 | 43 length = int(request.query.get('length', 26)) * 3600 |
44 | 44 |
45 response.set_header('Content-Type', 'image/png') | 45 response.set_header('Content-Type', 'image/png') |
46 return log.graph_png(start, length) | 46 return log.graph_png(start, length) |
47 | 47 |
48 @route('/') | 48 @route('/') |
59 f.close() | 59 f.close() |
60 | 60 |
61 return 'done' | 61 return 'done' |
62 | 62 |
63 def main(): | 63 def main(): |
64 bottle.debug(True) | 64 #bottle.debug(True) |
65 bottle.run(server='cgi') | 65 #bottle.run(reloader=True) |
66 bottle.run(server='cgi', reloader=True) | |
66 #bottle.run(port=9999, reloader=True) | 67 #bottle.run(port=9999, reloader=True) |
67 | 68 |
68 if __name__ == '__main__': | 69 if __name__ == '__main__': |
69 main() | 70 main() |
70 | 71 |