jinja2.sandbox

jinja2.sandbox

Adds a sandbox layer to Jinja as it was the default behavior in the old Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the default behavior is easier to use.

The behavior can be changed by subclassing the environment.

copyright:
  1. 2010 by the Jinja Team.
license:

BSD.

Classes

ImmutableSandboxedEnvironment Works exactly like the regular SandboxedEnvironment but does not
SandboxedEnvironment The sandboxed environment.

Exceptions

SecurityError([message]) Raised if a template tries to do something insecure if the

Functions

is_internal_attribute(obj, attr) Test if the attribute given is an internal python attribute.
modifies_known_mutable(obj, attr) This function checks if an attribute on a builtin mutable object (list, dict, set or deque) would modify it if called.
safe_range(*args) A range that can’t generate ranges with a length of more than
unsafe(f) Marks a function or method as unsafe.

Defined

  • CodeType
  • DictMixin
  • Environment
  • FrameType
  • FunctionType
  • GeneratorType
  • MAX_RANGE
  • MethodType
  • MutableMapping
  • MutableSequence
  • MutableSet
  • Set
  • TracebackType
  • UNSAFE_FUNCTION_ATTRIBUTES
  • UNSAFE_METHOD_ATTRIBUTES
  • UserDict
  • UserList
  • deque
  • operator
  • warnings

Table Of Contents

Previous topic

unicode_join

Next topic

ImmutableSandboxedEnvironment Class