Validators

philo.validators.INSECURE_TAGS

Tags which are considered insecure and are therefore always disallowed by secure TemplateValidator instances.

philo.validators.json_validator(value)

Validates whether value is a valid json string.

class philo.validators.TemplateValidator(allow=None, disallow=None, secure=True)

Validates whether a string represents valid Django template code.

Parameters:
  • allowNone or an iterable of tag names which are explicitly allowed. If provided, tags whose names are not in the iterable will cause a ValidationError to be raised if they are used in the template code.
  • disallowNone or an iterable of tag names which are explicitly allowed. If provided, tags whose names are in the iterable will cause a ValidationError to be raised if they are used in the template code. If a tag’s name is in allow and disallow, it will be disallowed.
  • secure – If the validator is set to secure, it will automatically disallow the tag names listed in INSECURE_TAGS. Defaults to True.

Project Versions

Previous topic

Signals

Next topic

Utilities

This Page