Hi Web2py users,
  I am using the parse_as_rest feature for filtering by date range:
The pattern is as follows:
        
 
"/unit/{unit.unit_id}/timeseries[timeseries.unit]/{timeseries.utc_time.ge}/{timeseries.utc_time.le}",
I couldn't find documentation that 'ge' and 'le' are valid for datetime 
fields, it seems to work well:
  
 http://localhost/manager/default/api/unit/123/timeseries/2013-05-01/2013-05-02

However, I need to filter based on date and time.

Ideally, I would like to send a request with the time as part of the date 
specification:
   http://localhost/manager/default/api/unit/123/timeseries/2013-05-01 
02:00/2013-05-02 00:00
However, this is an invalid request due to the ':' in the URI.
I looked into using seconds since epoch for the datetime spec, but that's 
too slow on sqlite.

I'm wondering if anybody knows an easy way to work around this?

The not so pretty solution I'm considering right now is to add a time as 
part of the URI after the date:
  
 
http://localhost/manager/default/api/unit/123/timeseries/2013-05-01/02/00/2013-05-02/00/00
Then, in the controller, I would modify the args before passing to the 
parse_as_rest() function by concating args 4 and 5 with the date in arg 3, 
to form the correct format ('YYYY-MM-YY hh:ss') that parse_as_rest() can 
use.

Any help much appreciated.

Regards,
Bernard

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to