Jinja "[[ x ]]" in the default of a parameter y always reuses x's default (if it exists) regardless of user input to x
See original GitHub issueIn v6.0.0-a.5
, the following copier.yml
always renders email
’s default prompt as foo@example.com
regardless of the input to the username
and organization
variables. In v5.1.0
, email
default prompt was based on the input to the username
and organization
variables.
# default
username:
type: str
default: "foo"
organization:
type: str
default: "example"
email:
type: str
# Notice that both `username` and `organization` have been already asked
default: "[[ username ]]@[[ organization ]].com"
Additionally, if the default of organization
is also a jinja template, email
s default will not use the rendered organization
default value.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Jinja2 template variable if None Object set a default value
This example uses the term "first_name" which we can assume will not expect a value of False , but there are many cases...
Read more >Template Designer Documentation - Jinja
Template Designer Documentation¶. This document describes the syntax and semantics of the template engine and will be most useful as reference to those ......
Read more >Jinja2 default() Test - OzNetNerd.com
This will output the value of my_variable if the variable was defined, otherwise 'my_variable is not defined'. If you want to use default...
Read more >Setting a default value with Default - Sendwithus
Jinja has a built in default filter that can be used to set a default value ... parameter will return the default value...
Read more >html - TOSCA Simple Profile in YAML Version 1.2 - OASIS Open
This document defines a simplified profile of the TOSCA version 1.0 specification in a YAML rendering which is intended to simplify the authoring...
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
Hi, I’ve run into this issue today testing a new setup with 6.0.0a6 With a really basic
copier.yaml
Running this without overriding the defaults results in expected behavior, until the template of a template:
However as reported, even when I overwrite the defaults at the prompt, they’re still used in the templated default:
I had the same problem trying to use earlier variables in
where:
keys, the default is always provided by the variable, orNone
if no default is set.Thanks! Let’s consider it fixed then. Please reopen otherwise.