Mercurial > templog
comparison web/templog.py @ 188:ae5efca89001
working OK
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 07 Feb 2014 23:32:08 +0800 |
parents | adbf70d1449f |
children | 101c66da848d |
comparison
equal
deleted
inserted
replaced
187:be1fde83630d | 188:ae5efca89001 |
---|---|
45 start = end - timedelta(minutes=length_minutes) | 45 start = end - timedelta(minutes=length_minutes) |
46 | 46 |
47 response.set_header('Content-Type', 'image/png') | 47 response.set_header('Content-Type', 'image/png') |
48 start_epoch = time.mktime(start.timetuple()) | 48 start_epoch = time.mktime(start.timetuple()) |
49 return log.graph_png(start_epoch, length_minutes * 60) | 49 return log.graph_png(start_epoch, length_minutes * 60) |
50 | |
51 @route('/set/update', method='post') | |
52 def update(): | |
53 post_json = json.loads(request.forms.data) | |
54 | |
55 csrf_blob = post_json['csrf_blob'] | |
56 | |
57 return str(post_json['params']) | |
50 | 58 |
51 @route('/set') | 59 @route('/set') |
52 def set(): | 60 def set(): |
53 return bottle.template('set', | 61 return bottle.template('set', |
54 inline_data = log.get_params(), | 62 inline_data = log.get_params(), |
115 @bottle.get('/<filename:re:.*\.js>') | 123 @bottle.get('/<filename:re:.*\.js>') |
116 def javascripts(filename): | 124 def javascripts(filename): |
117 response.set_header('Cache-Control', "public, max-age=1296000") | 125 response.set_header('Cache-Control', "public, max-age=1296000") |
118 return bottle.static_file(filename, root='static') | 126 return bottle.static_file(filename, root='static') |
119 | 127 |
120 @route('/setparams', method='post') | |
121 def update(): | |
122 post_json = json.loads(request.forms.data) | |
123 | |
124 csrf_blob = post_json['csrf_blob'] | |
125 | |
126 return str(post_json['params']) | |
127 | |
128 secure.setup_csrf() | 128 secure.setup_csrf() |
129 | 129 |
130 def main(): | 130 def main(): |
131 #bottle.debug(True) | 131 #bottle.debug(True) |
132 #bottle.run(reloader=True) | 132 #bottle.run(reloader=True) |