Skip to content
Myr

test.py

This file

Path

scripts/testproj/test.py

46 lines · 886 bytes · Python

Last changed by

Updated upgrade script to no longer change url_for that don't need to be changedArmin Ronacherbefore adoption85efa3f

History of this file

Take it

Updated upgrade script to no longer change url_for that don't need to be changedArmin Ronacherbefore adoption85efa3f

line 1why, one step back
1from flask import Flask, Module, render_template, url_for

Added test project I use for testingArmin Ronacherbefore adoption670d2bc

lines 2–5why, one step back
2
34mod = Module(__name__)5mod2 = Module(__name__, 'testmod2')

Allow name to be specified as the first parameter but with an explict name.Armin Ronacherbefore adoptionb4ffa4d

line 6why, one step back
6mod3 = Module(__name__, name='somemod', subdomain='meh')

Added test project I use for testingArmin Ronacherbefore adoption670d2bc

lines 7–14why, one step back
7
89@app.after_request10def after_request(response):11 g.db.close()12 return response1314

Updated upgrade script to no longer change url_for that don't need to be changedArmin Ronacherbefore adoption85efa3f

lines 15–21why, one step back
15@app.route('/')
16def index_foo():17 x1 = url_for('somemod.index')18 x2 = url_for('.index')19 return render_template('test/index.html')2021

Added test project I use for testingArmin Ronacherbefore adoption670d2bc

lines 22–23why, one step back
22@mod.route('/')
23def index():

Updated upgrade script to no longer change url_for that don't need to be changedArmin Ronacherbefore adoption85efa3f

lines 24–25why, one step back
24 x1 = url_for('somemod.index')
25 x2 = url_for('.index')

Added test project I use for testingArmin Ronacherbefore adoption670d2bc

lines 26–29why, one step back
26 return render_template('test/index.html')
272829@mod2.route('/')

Started documentation for blueprintsArmin Ronacherbefore adoptionbfd6776

line 30why, one step back
30def mod2_index():

Added test project I use for testingArmin Ronacherbefore adoption670d2bc

lines 31–33why, one step back
31 return render_template('testmod2/index.html')
3233

Started documentation for blueprintsArmin Ronacherbefore adoptionbfd6776

lines 34–35why, one step back
34@mod3.route('/')
35def mod3_index():

Added test project I use for testingArmin Ronacherbefore adoption670d2bc

line 36why, one step back
36 return render_template('something-else/index.html')

Started documentation for blueprintsArmin Ronacherbefore adoptionbfd6776

lines 37–46why, one step back
37
3839app = Flask(__name__)40app.register_module(mod)41app.register_module(mod2)424344def handle_404(error):45 return 'Testing', 40446app.error_handlers[404] = handle_404