Thanks! I didn't know that objects could be callable in Python.

On Feb 17, 10:44 pm, Anthony <[email protected]> wrote:
> db is a DAL object, which is callable. Its __call__ method takes a query
> and returns a Set object, which has a select() method for pulling records
> from the database. So, typically, you would do:
>
> db(query).select(...)
>
> However, you can call db without any query (it defaults to None), in which
> case, the select will simply return all records from the table specified in
> the select() call. So:
>
> db().select(db.image.ALL, orderby=db.image.title)
>
> returns all records in the db.image table. It is equivalent to:
>
> db(db.image.id > 0).select(db.image.ALL, orderby=db.image.title)
>
> Seehttp://web2py.com/books/default/chapter/29/6#select.
>
> Anthony
>
>
>
>
>
>
>
> On Friday, February 17, 2012 8:34:54 PM UTC-5, davidkw wrote:
>
> > For the line:
>
> > db().select(db.image.ALL, orderby=db.image.title)
>
> > Why is there a () after the "db" and before the select? Is db() a
> > method call of some kind?
>
> > Thanks for any clarification.

Reply via email to