Add name and filename to Environment.from_string
See original GitHub issueWhat do you think about add name
and filename
parameters in Environment.from_string
method ? https://github.com/pallets/jinja/blob/master/jinja2/environment.py#L849
Something like that:
def from_string(self, source, name=None, filename=None, globals=None, template_class=None):
"""Load a template from a string. This parses the source given and
returns a :class:`Template` object.
"""
globals = self.make_globals(globals)
cls = template_class or self.template_class
return cls.from_code(self, self.compile(source, name=name, filename=filename), globals, None)
Best regards, Stéphane
Issue Analytics
- State:
- Created 7 years ago
- Comments:18 (9 by maintainers)
Top Results From Across the Web
Import file using string as name - python - Stack Overflow
Add the path where module resides to sys.path. Import the module using __import__ function which accepts a string variable as module name.
Read more >How to retrieve environment variable from string name in KSH
and 'envVar' is the one of my environment variable's name containing a path (of a folder by instance). So I'd like to do...
Read more >GNU make - Functions for Transforming Text
Filename Functions: Functions for manipulating file names. Foreach Function: Repeat some text with controlled variation. Origin Function: Find where a variable ...
Read more >setx - Microsoft Learn
Creates or modifies environment variables in the user or system environment, ... setx [/s <computer> [/u [<domain>\]<user name> [/p ...
Read more >Python Generated Code | Protocol Buffers - Google Developers
The Python code generated by the protocol buffer compiler is completely unaffected by the package name defined in the .proto file. Instead, Python...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Correct, that will work.
Right. Even if providing two times the same information to a component may sound as unoptimal from a caller point of view, I can understand other reasons exist not to do it from a callee perspective…
Finally using Ansible, it appeared to be as simple as the following code to transfer the file name information into the template…
template: src: ‘{{ src_dir }}’ dest: ‘{{ dst_dir }}’ vars: file_path: “{{item.path}}” with_filetree: templates/xyz