Extract check_django_templates.

This commit is contained in:
Steve Howell 2016-07-08 19:57:30 +00:00 committed by Tim Abbott
parent 3e9ceaeaf0
commit 4e326ed138
1 changed files with 3 additions and 2 deletions

View File

@ -180,9 +180,10 @@ def check_our_files():
for fn in templates: for fn in templates:
validate(fn) validate(fn)
# Django templates are pretty messy now, so we do minimal checking.
templates = [fn for fn in git_files if fn.endswith('.html')] templates = [fn for fn in git_files if fn.endswith('.html')]
check_django_templates(templates)
def check_django_templates(templates):
def ok(fn): def ok(fn):
if 'templates' not in fn: return False if 'templates' not in fn: return False
if 'api.html' in fn: return False if 'api.html' in fn: return False
@ -191,9 +192,9 @@ def check_our_files():
templates = sorted(list(filter(ok, templates))) templates = sorted(list(filter(ok, templates)))
assert len(templates) >= 10 # sanity check that we are actually doing work assert len(templates) >= 10 # sanity check that we are actually doing work
for fn in templates: for fn in templates:
# Many of our Django templates have broken indentation.
validate(fn, check_indent=False) validate(fn, check_indent=False)
if __name__ == '__main__': if __name__ == '__main__':