Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to validate templates using jinja2schema #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kx-chen
Copy link
Contributor

@kx-chen kx-chen commented Dec 12, 2018

Use jinja2schema to validate templates when --validate-templates
is passed in.

Closes #99

@kx-chen kx-chen force-pushed the jinja2schema-validation branch 2 times, most recently from 75b77fb to cb41734 Compare December 15, 2018 11:44
statik/cmdline.py Outdated Show resolved Hide resolved
statik/project.py Outdated Show resolved Hide resolved
statik/views.py Outdated Show resolved Hide resolved
statik/utils.py Outdated
% (item, template))
except Exception as e:
logger.warning(
"Template validation failed (likely an issue with jinja2schema): %s: %s",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move the except so that it only catches errors in one line result = to_json_schema(infer(stripped_template)) and then change the warning to explicitly indicate the problem is within jinja2schema. Something like "Template inspection using jinja2schema failed: .."

Usually, only do one thing within try/except blocks. Then add another exception block to catch the next type of error.

Use jinja2schema to validate templates when --validate-templates
is passed in.

Closes thanethomson#99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants