Commit 3018c6751b3897665083d8ff13ad6825c829b301
Code review
- Files are now handled the proper way. Should not have relative references to files.
| | | | 18 | else: | 18 | else: |
---|
19 | return render_template('index.html') | 19 | return render_template('index.html') |
---|
20 | | 20 | |
---|
| | 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']) |
---|
22 | def editor(): | 24 | def 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) | | 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') | | 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) |
---|