jinja2.sandbox.SandboxedEnvironment.intercept_unop¶
-
SandboxedEnvironment.
intercept_unop
(operator)[source]¶ 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 ofcall_unop()
will use theunop_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.