Show
Ignore:
Timestamp:
05/21/05 23:39:07 (19 years ago)
Author:
jerome
Message:

The start= and end= data dumper filters now accept the magical
keywords 'yesterday', 'today', 'now' and 'tomorrow'.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/storage.py

    r2266 r2268  
    598598        if (startdate is None) and (enddate is None) :     
    599599            return (None, None) 
    600         if startdate.isdigit() and enddate.isdigit() : 
     600             
     601        now = DateTime.now()     
     602        nameddates = ('yesterday', 'today', 'now', 'tomorrow') 
     603        if ((startdate.lower() in nameddates) or startdate.isdigit()) and \ 
     604           ((enddate.lower() in nameddates) or enddate.isdigit()) :  
    601605            datedict = { "start" : startdate, "end" : enddate }     
    602606            for limit in datedict.keys() : 
    603607                dateval = datedict[limit] 
     608                if dateval in nameddates : 
     609                    if limit == "start" : 
     610                        if dateval == "yesterday" : 
     611                            dateval = (now - 1).Format("%Y%m%d000000") 
     612                        elif dateval == "today" : 
     613                            dateval = now.Format("%Y%m%d000000") 
     614                        elif dateval == "now" : 
     615                            dateval = now.Format("%Y%m%d%H%M%S") 
     616                        else : # tomorrow 
     617                            dateval = (now + 1).Format("%Y%m%d000000") 
     618                    else : 
     619                        if dateval == "yesterday" : 
     620                            dateval = (now - 1).Format("%Y%m%d235959") 
     621                        elif dateval == "today" : 
     622                            dateval = now.Format("%Y%m%d235959") 
     623                        elif dateval == "now" : 
     624                            dateval = now.Format("%Y%m%d%H%M%S") 
     625                        else : # tomorrow 
     626                            dateval = (now + 1).Format("%Y%m%d235959") 
     627                         
    604628                lgdateval = len(dateval) 
    605629                if lgdateval == 4 :