Ok, so far we did everything right.
But most of the time you and me will mak some mistakes. In this case web2py will tell us.
For example lets simulate a typo. This happens even the best programmers. Change the word
crud in the second line of the
entry_post funtion to
crid - missed that u, don't you:
go to http://localhost:8000/pitch/default/entry_post and web2py shows you an error message.
If you click on the link to the ticket, web2py wants you to login with your admin password and then show you the whole error ticket.
The ticket has a lot of information like the Python runtime, the environment variables, etc. The interesting part for us are the error message and the traceback.
The error message tells us, that there is something fishy going on with the global
name crid. Of course it is, we wrote it intentianally. Unlike
crid is not defined is our namespace and for that reason web2py (or better Python) doesn't know what to do with it.
In general, a namespace is a container that provides context for the identifiers (names, or technical terms, or words) it holds, and allows the disambiguation of homonym identifiers residing in different namespaces.
For many programming languages, a namespace is a context for their identifiers. In an operating system, an example of namespace is a directory. Each name in a directory uniquely identifies one file or subdirectory, but one file may have the same name multiple times.
The traceback shows us where we can find the mistake. In our example it is in
controllers/default.py, line 73, in the function
Correct the mistake
Now we could just correct the mistake and we would be done. But for the sake of repetition we will use Mercurial to revert the mistake:
$ hg status #let's which files are affected since last commit
Now everything should work as exspected.