diff --git a/scripts/flask-07-upgrade.py b/scripts/flask-07-upgrade.py index daf915b6..5df500c4 100644 --- a/scripts/flask-07-upgrade.py +++ b/scripts/flask-07-upgrade.py @@ -44,7 +44,7 @@ _url_for_re = re.compile(r'\b(url_for\()(%s)' % _string_re_part) _render_template_re = re.compile(r'\b(render_template\()(%s)' % _string_re_part) _after_request_re = re.compile(r'((?:@\S+\.(?:app_)?))(after_request)(\b\s*$)(?m)') _module_constructor_re = re.compile(r'([a-zA-Z0-9_][a-zA-Z0-9_]*)\s*=\s*Module' - r'\(__name__\s*(?:,\s*(%s))?' % + r'\(__name__\s*(?:,\s*(?:name\s*=\s*)?(%s))?' % _string_re_part) _error_handler_re = re.compile(r'%s\.error_handlers\[\s*(\d+)\s*\]' % _app_re_part) _mod_route_re = re.compile(r'([a-zA-Z0-9_][a-zA-Z0-9_]*)\.route') @@ -248,10 +248,13 @@ def upgrade_template_file(filename, contents): def walk_path(path): + this_file = os.path.realpath(__file__).rstrip('c') for dirpath, dirnames, filenames in os.walk(path): dirnames[:] = [x for x in dirnames if not x.startswith('.')] for filename in filenames: filename = os.path.join(dirpath, filename) + if os.path.realpath(filename) == this_file: + continue if filename.endswith('.py'): yield filename, 'python' # skip files that are diffs. These might be false positives diff --git a/scripts/testproj/test.py b/scripts/testproj/test.py index b892db1b..8073f3c8 100644 --- a/scripts/testproj/test.py +++ b/scripts/testproj/test.py @@ -3,6 +3,7 @@ from flask import Flask, Module mod = Module(__name__) mod2 = Module(__name__, 'testmod2') +mod3 = Module(__name__, name='somemod', subdomain='meh') app = Flask(__name__) app.register_module(mod)