Early commit for issue #1135
Add support migrating single imports from the flask.ext style to flask_
This commit is contained in:
parent
4dc3c16c3d
commit
9d64ff420f
3 changed files with 69 additions and 0 deletions
19
scripts/temp.py
Normal file
19
scripts/temp.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
from flask_foo import bam
|
||||
import flask_foo as foo
|
||||
|
||||
def migrate(old_file):
|
||||
new_file = open("temp.py", "w")
|
||||
for line in old_file:
|
||||
if line[0, 15] is "from flask.ext":
|
||||
if line[15] == '.':
|
||||
import_statement = line[16::].split(' ')
|
||||
extension = import_statement[0]
|
||||
line = line. replace("flask.ext." + extension,
|
||||
"flask_" + extension)
|
||||
else:
|
||||
pass
|
||||
|
||||
new_file.write(line)
|
||||
|
||||
if __name__ == "__main__":
|
||||
old_file = open(sys.arv[1])
|
||||
Loading…
Add table
Add a link
Reference in a new issue