query &= db.flatpage.f==request.function

is the same as 

   query = query & (db.flatpage.f==request.function)

Build a query from another query
Instead

   alphabetical = User.first_name|User.last_name

is the same as 

   alphabetical = [User.first_name, User.last_name]

makes a list of fields to use for sorting.

On Saturday, 28 March 2015 11:14:52 UTC-5, Paul McDonald wrote:
>
> In the Web2py Application Development Cookbook:
>
>  p82    the  &=  operators
>
>
>  if not form:
>
> # search flatpage according to the current request
>
> query = db.flatpage.c==request.controller
>
> query &= db.flatpage.f==request.function     *<-----  what is going on 
> here?*
>
> if request.args:
>
> query &= db.flatpage.args==request.args(0)
>
> else:
>
> query &= (db.flatpage.args==None)|(db.flatpage.args=='')
>
> query &= db.flatpage.lang==lang
>
>
>  Alos, p69    the   |   bianary or operator
>
> alphabetical = User.first_name|User.last_name   *     <------  what is 
> going on here?   *
>   
>
>   Can anyone explain what these are doing?
> Thank you in advance
>
>
> Paul
>   
>

-- 
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.

Reply via email to