summaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-11-02 17:37:15 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2013-11-02 17:37:15 -0700
commitfe995e6cbdcf2766cf0aa951c8ef4549ad27694c (patch)
tree049678d37554ef07633ea714fe359952bf6cbdde /extras
parent393cdbfaa2d47c85f6764e80600de48f26f43327 (diff)
Fixed the remaining E302 violations int eh django package
Diffstat (limited to 'extras')
-rwxr-xr-xextras/csrf_migration_helper.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/extras/csrf_migration_helper.py b/extras/csrf_migration_helper.py
index ffa8b0b924..818c1263b7 100755
--- a/extras/csrf_migration_helper.py
+++ b/extras/csrf_migration_helper.py
@@ -137,6 +137,7 @@ _POST_FORM_RE = \
_FORM_CLOSE_RE = re.compile(r'</form\s*>')
_TOKEN_RE = re.compile('\{% csrf_token')
+
def get_template_dirs():
"""
Returns a set of all directories that contain project templates.
@@ -153,6 +154,7 @@ def get_template_dirs():
dirs.update(app_template_dirs)
return dirs
+
def make_template_info(filename, root_dirs):
"""
Creates a Template object for a filename, calculating the possible
@@ -241,6 +243,7 @@ class Template(object):
def __hash__(self):
return hash(self.absolute_filename)
+
def get_templates(dirs):
"""
Returns all files in dirs that have template extensions, as Template
@@ -257,6 +260,7 @@ def get_templates(dirs):
templates.add(t)
return templates
+
def get_python_code(paths):
"""
Returns all Python code, as a list of tuples, each one being:
@@ -275,6 +279,7 @@ def get_python_code(paths):
retval.append((fn, content))
return retval
+
def search_python_list(python_code, template_names):
"""
Searches python code for a list of template names.
@@ -286,6 +291,7 @@ def search_python_list(python_code, template_names):
retval.update(search_python(python_code, tn))
return sorted(retval)
+
def search_python(python_code, template_name):
"""
Searches Python code for a template name.
@@ -300,6 +306,7 @@ def search_python(python_code, template_name):
retval.append((fn, ln + 1))
return retval
+
def main(pythonpaths):
template_dirs = get_template_dirs()
templates = get_templates(template_dirs)