On Feb 3, 8:27 pm, devGS <[email protected]> wrote:
> Hi, I have a few general questions, answers for which I didn't find in
> the book:
> 1. How does the model work in web2py's MVC? What is the workflow? When
> does the code from those files called? The only relevant information I
> found was the sequence diagram from the book.
yes this is an important omission.
at every http request, all models are executed in the same
environment. Then environment is copied. The requested controller is
executed and the called function is called. The output dict() is added
to the copied environment and passed to the view. The output is
returned to the visitor.
> 2. How does the following form of passing arguments in Python work:
> cache.ram.clear(regex='...')? I come from Java, as I understand regex
> is some kind of an optional value to be passed?
regex is any regular expression. All keys in the cache matching the
regular expression are deleted from the cache.
> 3. How do the layouts work (layout as a pattern that is being used in
> the views)? I tried to do the following, which sometimes works and
> sometimes not, providing errors: remove the {{extend 'layout.html'}}
> from some view, i.e. "myview.html" and add {{include "myview.html"}}
> into a second view. Mainly, it works, but when I try to remove
> {{extend 'layout.html'}} from "default/user.html" and add {{include
> 'default/user.html'}} into "index.html", it fails. Why, and how to do
> it properly?
Think of a tree. Each node is an HTML file. You move up by calling
extend. You move down by calling include. The parent should have a
simple {{include}} not {{include "child.html"}} where the extending
child is to be inserted. This is in the book in some detail.
> 4. I understood that in order to manipulate my database from GAE, I
> need to index my tables. Where can I find information about indexing
> and what is it?
You only need this for speed. You have to do this in sql
db.executesql("....")
> 5. While uploading my app into GAE, I find the example entries inside
> my online GAE app. Why is that and how to prevent it?
I am not sure I understand this question.