Example #1
0
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"]
Example #2
0
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():
Example #3
0
File: app.py Project: ididy/lunar
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)
Example #4
0
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():