else: from io import BytesIO as StringIO from lunar.lunar import Lunar, LunarException, _Stack from lunar.router import RouterException def start_response(status, headerlist): pass class SimpleClass(object): pass app = Lunar('__main__') dirname, filename = os.path.split(os.path.abspath(__file__)) app.root_path = dirname @app.route('/', methods=["GET", "POST"]) def index(): return "Hello, lunar!" #/args?key=lunar&count=4 @app.route('/test_args', methods=["GET"]) def args(): return app.request.args["key"], app.request.args["count"]
from lunar.lunar import Lunar app = Lunar('__main__') @app.route('/', methods=["GET", "POST"]) def index(): return "Hello, lunar!" #/args?key=lunar&count=4 @app.route('/test_args', methods=["GET"]) def test_args(): return app.request.args["key"], app.request.args["count"] # template @app.route('/template') def template(): return app.render('index.html') @app.route('/template_with_noescape') def test_escape(): return app.render('test_escape.html', content="<p>hello escape</p>") @app.route('/url_for_with_args') def test_url_for_with_args():
from lunar.lunar import Lunar app = Lunar('__main__') @app.route('/', methods=["GET", "POST"]) def index(): return "Hello, lunar!" #/args?key=lunar&count=4 @app.route('/test_args', methods=["GET"]) def test_args(): return app.request.args["key"], app.request.args["count"] # template @app.route('/template') def template(): return app.render('index.html') @app.route('/template_with_noescape') def test_escape(): return app.render('test_escape.html', content="<p>hello escape</p>") @app.route('/url_for_with_args') def test_url_for_with_args(): return app.url_for(test_sync_args, id=1)
else: from io import BytesIO as StringIO from lunar.lunar import Lunar, LunarException, _Stack from lunar.router import RouterException def start_response(status, headerlist): pass class SimpleClass(object): pass app = Lunar('__main__') dirname, filename = os.path.split(os.path.abspath(__file__)) app.root_path = dirname @app.route('/', methods=["GET", "POST"]) def index(): return "Hello, lunar!" #/args?key=lunar&count=4 @app.route('/test_args', methods=["GET"]) def args():