question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should we optimize cookiecutter.XYZ == "y"?

See original GitHub issue

I think we should move from this pattern:

{% cookiecutter.XYZ == "y" %}

to this pattern:

{% cookiecutter.XYZ.lower() in ["y", "yes"] %}

Thoughts?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
hackebrotcommented, Mar 12, 2018

Hi there! 👋

Ideally we would move to a new context format which supports typed Cookiecutter variables.

Doing so would allow us to better separate the UI from the template code, meaning that as a template author I would not have to care about accepted input values for variables, but only about the value that Cookiecutter writes to the context for that particular type.

For instance ["y", "ye", "yes"] might be all valid values for a Boolean variable, but will be stored as True in the Cookiecutter context resulting in the following template code:

{% if cookiecutter.XYZ %}
Hello {{ cookiecutter.name }}!
{% endif %}

I believe one of the reasons for Cookiecutter’s popularity and adoption in the Python community is that it uses the Jinja2 template engine and folks don’t have to learn yet another template language. So I’d prefer to not introduce any Cookiecutter specific APIs to templates.

0reactions
github-actions[bot]commented, Jan 10, 2022

Automatically closing after waiting for additional info. To re-open, please provide the additional information requested.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Boolean parameters parsed as String · Issue #1625 - GitHub
We want to add the ability to specify boolean parameters as "true" JSON booleans and naturally prompt for them. Thus the usage of...
Read more >
Learn the Basics of Cookiecutter by Creating a Cookiecutter
With Cookiecutter, you can easily bootstrap a new project from a standard form, which means you skip all the usual mistakes when starting...
Read more >
Cookie Cutter 3 Act Math Task | Area; Circles, Composite
Cookie Cutter 3 Act Math Task is a real world math problem requiring application of area of composite figures to find out how...
Read more >
Marketing Data Science - Case Studies from Airbnb, Lyft ...
In this article we'll look at several case data science case studies from marketing optimization efforts at companies like Lyft, Airbnb, ...
Read more >
How to Optimize Your Marketing Resume Like an SEO Pro
The job ad is like a keyword package handed down from the Almighty. Extract the most important keywords. These are usually marketing skills, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found