If a format call is detected, then this is routed through this method so that our safety sandbox can be used for it.
(self, s, args, kwargs)
| 403 | ), name=attribute, obj=obj, exc=SecurityError) |
| 404 | |
| 405 | def format_string(self, s, args, kwargs): |
| 406 | """If a format call is detected, then this is routed through this |
| 407 | method so that our safety sandbox can be used for it. |
| 408 | """ |
| 409 | if isinstance(s, Markup): |
| 410 | formatter = SandboxedEscapeFormatter(self, s.escape) |
| 411 | else: |
| 412 | formatter = SandboxedFormatter(self) |
| 413 | kwargs = _MagicFormatMapping(args, kwargs) |
| 414 | rv = formatter.vformat(s, args, kwargs) |
| 415 | return type(s)(rv) |
| 416 | |
| 417 | def call(__self, __context, __obj, *args, **kwargs): |
| 418 | """Call an object from sandboxed code.""" |
no test coverage detected