forked from orbit-oss/flask
Started documenting the upgrade script
This commit is contained in:
parent
aa863efd92
commit
9770054dee
2 changed files with 37 additions and 2 deletions
|
|
@ -22,7 +22,39 @@ installation, make sure to pass it the ``-U`` parameter::
|
||||||
Version 0.7
|
Version 0.7
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
The following backwards incompatible changes exist from 0.6 to 0.7
|
In Flask 0.7 we cleaned up the code base internally a lot and did some
|
||||||
|
backwards incompatible changes that make it easier to implement larger
|
||||||
|
applications with Flask. Because we want to make upgrading as easy as
|
||||||
|
possible we tried to counter the problems arising from these changes by
|
||||||
|
providing a script that can ease the transition.
|
||||||
|
|
||||||
|
The script scans your whole application and generates an unified diff with
|
||||||
|
changes it assumes are safe to apply. However as this is an automated
|
||||||
|
tool it won't be able to find all use cases and it might miss some. We
|
||||||
|
internally spread a lot of deprecation warnings all over the place to make
|
||||||
|
it easy to find pieces of code that it was unable to upgrade.
|
||||||
|
|
||||||
|
We strongly recommend that you hand review the generated patchfile and
|
||||||
|
only apply the chunks that look good.
|
||||||
|
|
||||||
|
If you are using git as version control system for your project we
|
||||||
|
recommend applying the patch with ``path -p1 < patchfile.diff`` and then
|
||||||
|
using the interactive commit feature to only apply the chunks that look
|
||||||
|
good.
|
||||||
|
|
||||||
|
To apply the upgrade script do the following:
|
||||||
|
|
||||||
|
1. Download the script: `flask-07-upgrade.py
|
||||||
|
<http://github.com/mitsuhiko/flask/tree/raw/master/scripts/flask-07-upgrade.py>`_
|
||||||
|
2. Run it in the directory of your application::
|
||||||
|
|
||||||
|
python flask-07-upgrade.py > patchfile.diff
|
||||||
|
|
||||||
|
3. Review the generated patchfile.
|
||||||
|
4. Apply the patch::
|
||||||
|
|
||||||
|
patch -p1 < patchfile.diff
|
||||||
|
|
||||||
|
|
||||||
Bug in Request Locals
|
Bug in Request Locals
|
||||||
`````````````````````
|
`````````````````````
|
||||||
|
|
|
||||||
|
|
@ -245,11 +245,14 @@ def upgrade_template_file(filename, contents):
|
||||||
|
|
||||||
def walk_path(path):
|
def walk_path(path):
|
||||||
for dirpath, dirnames, filenames in os.walk(path):
|
for dirpath, dirnames, filenames in os.walk(path):
|
||||||
|
dirnames[:] = [x for x in dirnames if not x.startswith('.')]
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
filename = os.path.join(dirpath, filename)
|
filename = os.path.join(dirpath, filename)
|
||||||
if filename.endswith('.py'):
|
if filename.endswith('.py'):
|
||||||
yield filename, 'python'
|
yield filename, 'python'
|
||||||
else:
|
# skip files that are diffs. These might be false positives
|
||||||
|
# when run multiple times.
|
||||||
|
elif not filename.endswith(('.diff', '.patch', '.udiff')):
|
||||||
with open(filename) as f:
|
with open(filename) as f:
|
||||||
contents = f.read(TEMPLATE_LOOKAHEAD)
|
contents = f.read(TEMPLATE_LOOKAHEAD)
|
||||||
if '{% for' or '{% if' or '{{ url_for' in contents:
|
if '{% for' or '{% if' or '{{ url_for' in contents:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue