<NME> application.py
<BEF> 
# all the imports
from flask import Flask, request, session, g, redirect, url_for, \
     abort, render_template, flash
import redis

    
from flask import Flask, request, render_template, make_response, url_for

from rsted.html import rst2html as _rst2html
from rsted.pdf import rst2pdf as _rst2pdf

from flaskext.helpers import render_html

# handle relative path references by changing to project directory
run_from = os.path.dirname(os.path.abspath(sys.argv[0]))
if run_from != os.path.curdir:
    os.chdir(run_from)

# create our little application :)
app = Flask(__name__)
app.config.from_pyfile(os.environ.get('RSTED_CONF', 'settings.py'))



def view_is_active(view_name):
        if not result:
            r = connect_redis()
    
@app.route("/")
def hello():
    return "Hello World!"

if __name__ == '__main__':
    app.run(host='0.0.0.0')
@app.route('/about/')
def about():
    return render_template('about.html')

@app.route('/srv/rst2html/', methods=['POST', 'GET'])
def rst2html():
    rst = request.form.get('rst', '')
    theme = request.form.get('theme')
    if theme == 'basic':
        theme = None
    html = _rst2html(rst, theme=theme)
    return html

@app.route('/srv/rst2pdf/', methods=['POST'])
def rst2pdf():
    rst = request.form.get('rst', '')
    theme = request.form.get('theme')
    if theme == 'basic':
        theme = None

    pdf = _rst2pdf(rst, theme=theme)
    responce = make_response(pdf)
    responce.headers['Content-Type'] = 'application/pdf'
    responce.headers['Content-Disposition'] = 'attachment; filename="rst.pdf"'
    responce.headers['Content-Transfer-Encoding'] = 'binary'
    return responce


if __name__ == '__main__':
    app.run(host=app.config.get('HOST', '0.0.0.0'),
            port=app.config.get('PORT', 5000))

<MSG> initial commit

<DFF> @@ -1,7 +1,7 @@
 
 # all the imports
 from flask import Flask, request, session, g, redirect, url_for, \
-     abort, render_template, flash
+     abort, render_template, flash, jsonify
 import redis
 
     
@@ -27,9 +27,17 @@ def before_request():
         if not result:
             r = connect_redis()
     
+
 @app.route("/")
-def hello():
-    return "Hello World!"
+def index(request):
+    saved_doc_id = request.args.get('n')
+    rst = ''
+    #if saved_doc_id:
+    #    saved_doc = SavedDocument.objects.filter(hash=saved_doc_id)
+    #    if saved_doc[:]:
+    #        rst = saved_doc[0].rst
+    js_params = {'rst': rst, 'theme': request.args.get('theme', '')}
+    return render_template('index.html', js_params=jsonify(js_params))
 
 if __name__ == '__main__':
     app.run(host='0.0.0.0')

initial commit