| OLD | NEW |
| 1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
| 2 """ | 2 """ |
| 3 jinja2.sandbox | 3 jinja2.sandbox |
| 4 ~~~~~~~~~~~~~~ | 4 ~~~~~~~~~~~~~~ |
| 5 | 5 |
| 6 Adds a sandbox layer to Jinja as it was the default behavior in the old | 6 Adds a sandbox layer to Jinja as it was the default behavior in the old |
| 7 Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the | 7 Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the |
| 8 default behavior is easier to use. | 8 default behavior is easier to use. |
| 9 | 9 |
| 10 The behavior can be changed by subclassing the environment. | 10 The behavior can be changed by subclassing the environment. |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 class ImmutableSandboxedEnvironment(SandboxedEnvironment): | 359 class ImmutableSandboxedEnvironment(SandboxedEnvironment): |
| 360 """Works exactly like the regular `SandboxedEnvironment` but does not | 360 """Works exactly like the regular `SandboxedEnvironment` but does not |
| 361 permit modifications on the builtin mutable objects `list`, `set`, and | 361 permit modifications on the builtin mutable objects `list`, `set`, and |
| 362 `dict` by using the :func:`modifies_known_mutable` function. | 362 `dict` by using the :func:`modifies_known_mutable` function. |
| 363 """ | 363 """ |
| 364 | 364 |
| 365 def is_safe_attribute(self, obj, attr, value): | 365 def is_safe_attribute(self, obj, attr, value): |
| 366 if not SandboxedEnvironment.is_safe_attribute(self, obj, attr, value): | 366 if not SandboxedEnvironment.is_safe_attribute(self, obj, attr, value): |
| 367 return False | 367 return False |
| 368 return not modifies_known_mutable(obj, attr) | 368 return not modifies_known_mutable(obj, attr) |
| OLD | NEW |