Skip to content
Myr

Started documenting the upgrade script

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent aa863ef · Browse files · 2 files+37 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+37 added−2 removed

  • other:+37 added−2 removed

2 files+37 added−2 removed

modified:docs/upgrading.rst+33 added-1 removed
20 unmodified lines
2122Version 0.723-----------2425The following backwards incompatible changes exist from 0.6 to 0.725In Flask 0.7 we cleaned up the code base internally a lot and did some26backwards incompatible changes that make it easier to implement larger27applications with Flask. Because we want to make upgrading as easy as28possible we tried to counter the problems arising from these changes by29providing a script that can ease the transition.3031The script scans your whole application and generates an unified diff with32changes it assumes are safe to apply. However as this is an automated33tool it won't be able to find all use cases and it might miss some. We34internally spread a lot of deprecation warnings all over the place to make35it easy to find pieces of code that it was unable to upgrade.3637We strongly recommend that you hand review the generated patchfile and38only apply the chunks that look good.3940If you are using git as version control system for your project we41recommend applying the patch with ``path -p1 < patchfile.diff`` and then42using the interactive commit feature to only apply the chunks that look43good.4445To apply the upgrade script do the following:46471. Download the script: `flask-07-upgrade.py48 <http://github.com/mitsuhiko/flask/tree/raw/master/scripts/flask-07-upgrade.py>`_492. Run it in the directory of your application::5051 python flask-07-upgrade.py > patchfile.diff52533. Review the generated patchfile.544. Apply the patch::5556 patch -p1 < patchfile.diff575859Bug in Request Locals60`````````````````````6162Due to a bug in earlier implementations the request local proxies now
181 unmodified lines
modified:scripts/flask-07-upgrade.py+4 added-1 removed
243 unmodified lines
244245246def walk_path(path):247 for dirpath, dirnames, filenames in os.walk(path):248 dirnames[:] = [x for x in dirnames if not x.startswith('.')]249 for filename in filenames:250 filename = os.path.join(dirpath, filename)251 if filename.endswith('.py'):252 yield filename, 'python'252 else:253 # skip files that are diffs. These might be false positives254 # when run multiple times.255 elif not filename.endswith(('.diff', '.patch', '.udiff')):256 with open(filename) as f:257 contents = f.read(TEMPLATE_LOOKAHEAD)258 if '{% for' or '{% if' or '{{ url_for' in contents:259 yield filename, 'template'
65 unmodified lines