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
Provenance
- Commit
9770054- Tree
061acb3- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
aa863ef
2 files changed+37 added−2 removed
modified:docs/upgrading.rst+33 added-1 removed
20 unmodified lines21 22 Version 0.723 -----------24 25-The following backwards incompatible changes exist from 0.6 to 0.725+In Flask 0.7 we cleaned up the code base internally a lot and did some26+backwards incompatible changes that make it easier to implement larger27+applications with Flask. Because we want to make upgrading as easy as28+possible we tried to counter the problems arising from these changes by29+providing a script that can ease the transition.30 31+The script scans your whole application and generates an unified diff with32+changes it assumes are safe to apply. However as this is an automated33+tool it won't be able to find all use cases and it might miss some. We34+internally spread a lot of deprecation warnings all over the place to make35+it easy to find pieces of code that it was unable to upgrade.36+37+We strongly recommend that you hand review the generated patchfile and38+only apply the chunks that look good.39+40+If you are using git as version control system for your project we41+recommend applying the patch with ``path -p1 < patchfile.diff`` and then42+using the interactive commit feature to only apply the chunks that look43+good.44+45+To apply the upgrade script do the following:46+47+1. Download the script: `flask-07-upgrade.py48+ <http://github.com/mitsuhiko/flask/tree/raw/master/scripts/flask-07-upgrade.py>`_49+2. Run it in the directory of your application::50+51+ python flask-07-upgrade.py > patchfile.diff52+53+3. Review the generated patchfile.54+4. Apply the patch::55+56+ patch -p1 < patchfile.diff57+58+59 Bug in Request Locals60 `````````````````````61 62 Due to a bug in earlier implementations the request local proxies now181 unmodified linesmodified:scripts/flask-07-upgrade.py+4 added-1 removed
243 unmodified lines244 245 246 def 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