Using and Mastering Cookiecutter Transcripts
Chapter: Creating Cookiecutter templates
Lecture: Concept: Choice values

Login or purchase this course to watch this video and the rest of the course contents.
0:01 Any time you have a bounded list of options and that list is pretty short, it's really nice to make that what is called a choice variable.
0:09 So here we come in in Pyramid, the Cookiecutter starter example this is one of the main official cookiecutters
0:17 for creating a basic more or less empty Pyramid web application, they come in here, one of the questions they have to ask you is
0:24 do you want to use Jinja2 or do you want to use Chameleon as your underlying templating engine.
0:29 So if we come in it will ask us things like what is the project name, and so on,
0:32 and then it says select your templating language 1 for Jinja2, 2 for Chameleon. And notice that whichever you want the default to be,
0:39 that one should be listed first in this list. So this works great when your options are a small set of known items,
0:47 here we just have two and the chances somebody misspells Chameleon or doesn't know they can type Chameleon or Jinja
0:54 1 or 2, anybody can do that, this works really well. So in the cookiecutter.json, that is how we control these,
1:01 and we saw this is really just a list of strings, so here we have a list of strings,
1:04 and they get turned into number 1, number 2, number 3 for user input.


Talk Python's Mastodon Michael Kennedy's Mastodon