Changeset 2268

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

Location:
pykota/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/NEWS

    r2266 r2268  
    2222PyKota NEWS : 
    2323        
     24    - 1.23alpha5 : 
     25     
     26        - The data dumper's start= and end= date filtering options now accept  
     27          the special keywords 'yesterday', 'today', 'now' and 'tomorrow'. 
     28           
    2429    - 1.23alpha4 : 
    2530     
  • 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 : 
  • pykota/trunk/pykota/version.py

    r2267 r2268  
    2222# 
    2323 
    24 __version__ = "1.23alpha4_unofficial" 
     24__version__ = "1.23alpha5_unofficial" 
    2525 
    2626__doc__ = "PyKota : a complete Printing Quota Solution for CUPS and LPRng."