Created
June 18, 2014 10:45
-
-
Save evansd/5e20e3c4aed9933eafe8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import fileinput, re | |
| for line in fileinput.input(inplace=True): | |
| if fileinput.isfirstline(): | |
| future_load = '{% load url from future %}' | |
| if '{% extends' in line: | |
| print line, | |
| print future_load | |
| else: | |
| print future_load | |
| print line, | |
| else: | |
| print re.sub(r'{% *url +([a-zA-Z0-9_.:-]+)', r"{% url '\1'", line), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment