コード例 #1
0
ファイル: test_app.py プロジェクト: AugustLONG/lunar
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"]
コード例 #2
0
ファイル: app.py プロジェクト: break2017/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():
コード例 #3
0
ファイル: app.py プロジェクト: 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)
コード例 #4
0
ファイル: test_app.py プロジェクト: break2017/lunar
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():