On Apr 13, 10:06 am, greenpoise <[email protected]> wrote:
> Hi all. Dont know where to begin when it comes to controllers. I used
> to develop client/server applications and the transition to
> webframeworks web developing in general has been tough for me. Do I
> simply use pure python on web2py controllers?

Yes, all code in the controllers and models is Python.
Views are also converted to Python code.

> I bought the book and
> its perfect but I need more. Any leads? books? tutorials? is just the
> controllers part that just does not do it for me. For example, I was
> taking a look at I/O. Do I apply a python I/O function to the
> controller just as I would in a regular python expression?

Section 4.2 of the book explains what happens.

If the URL does not request a static file web2py processes the request
in the following order:
• Parses cookies.
• Creates an environment in which to execute the function.
• Initializes request, response, cache.
• Opens the existing session or creates a new one.
• Executes the models belonging to the requested application.
• Executes the requested controller action function.
• If the function returns a dictionary, executes the associated view.
• On success, commits all open transactions.
• Saves the session.
• Returns an HTTP response.

Note the part about a dictionary. If the controller returns a
dictionary then a view is used to format the response, otherwise the
return from the controller is used as the response.

> Thanks
>
> Dan


-- 
To unsubscribe, reply using "remove me" as the subject.

Reply via email to