This is all DAL syntax. I suggest you read the chapter on the DAL, particularly this section <http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#select> and this section <http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Fetching-a-Row> (for your question #2).
On Tuesday, February 24, 2015 at 8:49:01 AM UTC-5, Abhijit Chatterjee wrote: > > Hello, > > Does anyone know how to rewrite this two contoller line? After model and > view, I am trying to get familiar with controller and I am finding when a > code is summarized, its hard to understand at times. Wondering if someone > can break it down for me a little? > > first def: > > (1) categories = db(db.category).select(orderby=db.category.name) > > why two dbs? can we rewrite this without the select? Is select is a web2py > key word? I come from a MATLAB world where we define the structure first > and then use. I don't recall I defined select to be a struct. > > (2) similarly on my second def: > > category = db.category(request.args(0)) > > Now, I only see one db instead of two. Why? I understand the request args > means where I click. Which argument is it. > > also this line, > > news = db(db.news.category == category.id).select(orderby=db.news.vote) > > Its hard to understand when lot of arguments are combined into one. Anyone > can help break it down for me a little? Any idea about how to rewrite that, > may be even using "if"statement without structure if possible? > > > > > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

