mirror of https://github.com/pallets/flask.git
Merge pull request #2962 from garenchan/dev
Cache return values to avoid repeated function calls.
This commit is contained in:
commit
70b45094ab
|
@ -206,8 +206,9 @@ def prepare_import(path):
|
||||||
"""
|
"""
|
||||||
path = os.path.realpath(path)
|
path = os.path.realpath(path)
|
||||||
|
|
||||||
if os.path.splitext(path)[1] == '.py':
|
fname, ext = os.path.splitext(path)
|
||||||
path = os.path.splitext(path)[0]
|
if ext == '.py':
|
||||||
|
path = fname
|
||||||
|
|
||||||
if os.path.basename(path) == '__init__':
|
if os.path.basename(path) == '__init__':
|
||||||
path = os.path.dirname(path)
|
path = os.path.dirname(path)
|
||||||
|
|
Loading…
Reference in New Issue