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 fileTake it
Updated upgrade script to no longer change url_for that don't need to be changedArmin Ronacherbefore adoption85efa3f
line 1why, one step back1from flask import Flask, Module, render_template, url_forAdded test project I use for testingArmin Ronacherbefore adoption670d2bc
lines 2–5why, one step back234mod = 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 back6mod3 = Module(__name__, name='somemod', subdomain='meh')Added test project I use for testingArmin Ronacherbefore adoption670d2bc
lines 7–14why, one step back789@app.after_request10def after_request(response):11 g.db.close()12 return response1314Updated upgrade script to no longer change url_for that don't need to be changedArmin Ronacherbefore adoption85efa3f
lines 15–21why, one step back15@app.route('/')16def index_foo():17 x1 = url_for('somemod.index')18 x2 = url_for('.index')19 return render_template('test/index.html')2021Added test project I use for testingArmin Ronacherbefore adoption670d2bc
lines 22–23why, one step back22@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 back24 x1 = url_for('somemod.index')25 x2 = url_for('.index')Added test project I use for testingArmin Ronacherbefore adoption670d2bc
lines 26–29why, one step back26 return render_template('test/index.html')272829@mod2.route('/')Started documentation for blueprintsArmin Ronacherbefore adoptionbfd6776
line 30why, one step back30def mod2_index():Added test project I use for testingArmin Ronacherbefore adoption670d2bc
lines 31–33why, one step back31 return render_template('testmod2/index.html')3233Started documentation for blueprintsArmin Ronacherbefore adoptionbfd6776
lines 34–35why, one step back34@mod3.route('/')35def mod3_index():Added test project I use for testingArmin Ronacherbefore adoption670d2bc
line 36why, one step back36 return render_template('something-else/index.html')Started documentation for blueprintsArmin Ronacherbefore adoptionbfd6776
lines 37–46why, one step back373839app = Flask(__name__)40app.register_module(mod)41app.register_module(mod2)424344def handle_404(error):45 return 'Testing', 40446app.error_handlers[404] = handle_404