You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the above, you (as expected) only get asked for "team_name", but when rendering something with {{ cookiecutter.project_name }}, I get an error:
Error message: 'collections.OrderedDict object' has no attribute 'project_name'
Context: {
"_cookiecutter": {
"team_name": "X"
},
"cookiecutter": {
"__project_name": "my_org_team_x",
"team_name": "X"
}
}
(removed a few other redundant variables)
Is my understanding of private variables in cookiecutter incorrect, or is this a bug? I would expect that I could reference the private variable whilst rendering with {{ cookiecutter.project_name }}.
What I've run:
See above
The text was updated successfully, but these errors were encountered:
BasPH
changed the title
Private variable are not exposed for rendering
Private variables are not exposed for rendering
Jan 15, 2024
I guess your assumption could've worked, so clarifying how rendered private variables are actually used seems like a good idea. I also quickly skimmed the docs and there doesn't seem to be an example of rendered private variables being used in the cookiecutter itself—perhaps most imporantly not in the section specifically about private variables.
It should be enough to extend the existing example from the section on private variables with the cookiecutter's directory structure:
Description:
I expected that I could use private variables for variables that I want to use for generating a project, but hide it for users. For example:
With the above, you (as expected) only get asked for "team_name", but when rendering something with
{{ cookiecutter.project_name }}
, I get an error:(removed a few other redundant variables)
Is my understanding of private variables in cookiecutter incorrect, or is this a bug? I would expect that I could reference the private variable whilst rendering with
{{ cookiecutter.project_name }}
.What I've run:
See above
The text was updated successfully, but these errors were encountered: