Commit e922d3bf5acdc767fa17ddc2ac7302665488cae6

  • avatar
  • arvind
  • Fri Feb 08 11:39:32 IST 2013
Module logging is to be imported in a specific order, otherwise it fails loading.  +Indentation fixes.
  • Diff rendering mode:
  • inline
  • side by side

fetch.py

2from flask import request2from flask import request
3from flask import render_template3from flask import render_template
4from flask import make_response4from flask import make_response
5import logging
5from logging import FileHandler6from logging import FileHandler
6import json7import json
7import pymongo8import pymongo
24 filename = request.args['json']24 filename = request.args['json']
25 else:25 else:
26 filename = 'test.json'26 filename = 'test.json'
27 filename = os.path.join('static', filename)
28 try:
29 f = open(filename, 'r')
30 except:
31 f = open('static/test.json', 'r')
32 buf = f.read()
33 f.close()
34 return render_template('editor.html', json = buf)
27 filename = os.path.join('static', filename)
28 try:
29 f = open(filename, 'r')
30 except:
31 f = open('static/test.json', 'r')
32 buf = f.read()
33 f.close()
34 return render_template('editor.html', json = buf)
3535
36@app.route('/saveJSON', methods=['POST'])36@app.route('/saveJSON', methods=['POST'])
37def saveJSON():37def saveJSON():