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,
0:04 it's really nice to make that what is called a choice variable.
0:08 So here we come in in Pyramid, the Cookiecutter starter example
0:12 this is one of the main official cookiecutters
0:16 for creating a basic more or less empty Pyramid web application,
0:20 they come in here, one of the questions they have to ask you is
0:23 do you want to use Jinja2 or do you want to use Chameleon
0:26 as your underlying templating engine.
0:28 So if we come in it will ask us things like what is the project name, and so on,
0:31 and then it says select your templating language 1 for Jinja2, 2 for Chameleon.
0:34 And notice that whichever you want the default to be,
0:38 that one should be listed first in this list.
0:41 So this works great when your options are a small set of known items,
0:46 here we just have two and the chances somebody misspells Chameleon
0:50 or doesn't know they can type Chameleon or Jinja
0:53 1 or 2, anybody can do that, this works really well.
0:56 So in the cookiecutter.json, that is how we control these,
1:00 and we saw this is really just a list of strings, so here we have a list of strings,
1:03 and they get turned into number 1, number 2, number 3 for user input.