It is not possible. We cannot ask the SQL engine to run a function
(date+timedelta) that is only defined in the client (*).
The only two ways to do it are:

1) the function only need to act on constant data (i.e. the right hand
side) and we support that already

2) fetch all the data and apply the filter client (*)-side. You can do
this yourself:

rows=db().select(db.my_table.ALL)
rows=[row for row in rows if row.start_date+datetime.timedelta
(days=row.ndays)>=current_date]

You can do this already and I think it is better to explicit when a
filtering is done client (*)-side.

(*) Here by client I mean database client (i.e. web2py) not the http
client (i.e. the browser)

Massimo


On Jun 22, 4:09 pm, Jose <[email protected]> wrote:
> On 22 jun, 20:27, mdipierro <[email protected]> wrote:
>
> > Not possible. You can only do
>
> >     query=(db.my_table.start_date>=current_date - datetime.timedelta
> > (days=30) )
>
> > the left hand side of  a "left op right" query has to be a field, not
> > an expression. The right hand side can be an expression but you cannot
> > mix python functions and sql functions.
>
> > Massimo
>
> Thank you.
>
> Did you think of supporting this?
>
> Jose
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to