Commit 3018c6751b3897665083d8ff13ad6825c829b301

  • avatar
  • arvind
  • Fri Feb 08 12:03:39 IST 2013
  • Tree SHA1: 3f77bd0
  • Parent SHA1: e922d3b (Module logging is to be imported in a specific order, otherwise it fails loading. +Indentation fixes.)
  • raw diff | raw patch
Code review
		 - Files are now handled the proper way.  Should not have relative references to files.
  • Diff rendering mode:
  • inline
  • side by side

fetch.py

18 else:18 else:
19 return render_template('index.html')19 return render_template('index.html')
2020
21 #fil = FileHandler(os.path.join(os.path.dirname(__file__),'logme'),mode='a')
22
21@app.route('/editor', methods=['GET'])23@app.route('/editor', methods=['GET'])
22def editor():24def editor():
23 if request.args.has_key('json'):25 if request.args.has_key('json'):
24 filename = request.args['json']26 filename = request.args['json']
25 else:27 else:
26 filename = 'test.json'28 filename = 'test.json'
27 filename = os.path.join('static', filename)
29 filename = os.path.join(os.path.join(os.path.dirname(__file__),'static'), filename)
28 try:30 try:
29 f = open(filename, 'r')31 f = open(filename, 'r')
30 except:32 except:
31 f = open('static/test.json', 'r')
33 f = open(os.path.join(os.path.join(os.path.dirname(__file__), 'static'), 'test.json'), 'r')
32 buf = f.read()34 buf = f.read()
33 f.close()35 f.close()
34 return render_template('editor.html', json = buf)36 return render_template('editor.html', json = buf)