jinja2.sandbox.ImmutableSandboxedEnvironment.intercept_unop

ImmutableSandboxedEnvironment.intercept_unop(operator)

Called during template compilation with the name of a unary operator to check if it should be intercepted at runtime. If this method returns True, call_unop() is excuted for this unary operator. The default implementation of call_unop() will use the unop_table dictionary to perform the operator with the same logic as the builtin one.

The following unary operators are interceptable: + and -

Intercepted calls are always slower than the native operator call, so make sure only to intercept the ones you are interested in.

New in version 2.6.