add missing options to overlay from __init__
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Tom Brouwer · committed by David Lord · parent ea69e41 · Browse files · 2 files·+14 added−1 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+14 added−1 removed
- other:+14 added−1 removed
Provenance
- Commit
21da8f5- Tree
007ba92- Author
Tom Brouwer <brouwer@floodtags.com>- Committer
David Lord <davidism@gmail.com>- Parent
ea69e41
2 files changed+14 added−1 removed
modified:src/jinja2/environment.py+11 added-1 removed
391 unmodified lines392 line_statement_prefix: t.Optional[str] = missing,393 line_comment_prefix: t.Optional[str] = missing,394 trim_blocks: bool = missing,395 lstrip_blocks: bool = missing,396+ newline_sequence: "te.Literal['\\n', '\\r\\n', '\\r']" = missing,397+ keep_trailing_newline: bool = missing,398 extensions: t.Sequence[t.Union[str, t.Type["Extension"]]] = missing,399 optimized: bool = missing,400 undefined: t.Type[Undefined] = missing,401 finalize: t.Optional[t.Callable[..., t.Any]] = missing,1 unmodified line403 loader: t.Optional["BaseLoader"] = missing,404 cache_size: int = missing,405 auto_reload: bool = missing,406 bytecode_cache: t.Optional["BytecodeCache"] = missing,407+ enable_async: bool = False,408 ) -> "Environment":409 """Create a new overlay environment that shares all the data with the410 current environment except for cache and the overridden attributes.411 Extensions cannot be removed for an overlayed environment. An overlayed3 unmodified lines415 Creating overlays should happen after the initial environment was set416 up completely. Not all attributes are truly linked, some are just417 copied over so modifications on the original environment may not shine418 through.419+420+ .. versionchanged:: 3.1.2421+ Added the ``newline_sequence``,, ``keep_trailing_newline``,422+ and ``enable_async`` parameters to match ``__init__``.423 """424 args = dict(locals())418- del args["self"], args["cache_size"], args["extensions"]425+ del args["self"], args["cache_size"], args["extensions"], args["enable_async"]426 427 rv = object.__new__(self.__class__)428 rv.__dict__.update(self.__dict__)429 rv.overlayed = True13 unmodified lines443 rv.extensions[key] = value.bind(rv)444 if extensions is not missing:445 rv.extensions.update(load_extensions(rv, extensions))446 447+ if enable_async is not missing:448+ rv.is_async = enable_async449+450 return _environment_config_check(rv)451 452 @property453 def lexer(self) -> Lexer:1214 unmodified linesmodified:CHANGES.rst+3 added
3 unmodified lines4 -------------5 6 Unreleased7 8+- Add parameters to ``Environment.overlay`` to match ``__init__``.9+ :issue:`1645`10 11+12 Version 3.1.113 -------------14 15 Released 2022-03-25959 unmodified lines