- Timestamp:
- 06/01/05 10:05:34 (19 years ago)
- Location:
- pykota/trunk
- Files:
-
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/NEWS
r2268 r2276 22 22 PyKota NEWS : 23 23 24 - 1.23alpha6 : 25 26 - The data dumper's start= and end= date filtering options now 27 accept a positive or negative offset to be added to the special 28 keywords 'yesterday', 'today', 'now', 'tomorrow'. 29 e.g. : dumpykota --data history start=yesterday-5 end=today 30 24 31 - 1.23alpha5 : 25 32 -
pykota/trunk/pykota/storage.py
r2268 r2276 601 601 now = DateTime.now() 602 602 nameddates = ('yesterday', 'today', 'now', 'tomorrow') 603 if ((startdate.lower() in nameddates) or startdate.isdigit()) and \ 604 ((enddate.lower() in nameddates) or enddate.isdigit()) : 605 datedict = { "start" : startdate, "end" : enddate } 606 for limit in datedict.keys() : 607 dateval = datedict[limit] 608 if dateval in nameddates : 603 datedict = { "start" : startdate.lower(), "end" : enddate.lower() } 604 for limit in datedict.keys() : 605 dateval = datedict[limit] 606 for name in nameddates : 607 if dateval.startswith(name) : 608 try : 609 offset = int(dateval[len(name):]) 610 except : 611 offset = 0 612 dateval = dateval[:len(name)] 609 613 if limit == "start" : 610 614 if dateval == "yesterday" : 611 dateval = (now - 1 ).Format("%Y%m%d000000")615 dateval = (now - 1 + offset).Format("%Y%m%d000000") 612 616 elif dateval == "today" : 613 dateval = now.Format("%Y%m%d000000")617 dateval = (now + offset).Format("%Y%m%d000000") 614 618 elif dateval == "now" : 615 dateval = now.Format("%Y%m%d%H%M%S")619 dateval = (now + offset).Format("%Y%m%d%H%M%S") 616 620 else : # tomorrow 617 dateval = (now + 1 ).Format("%Y%m%d000000")621 dateval = (now + 1 + offset).Format("%Y%m%d000000") 618 622 else : 619 623 if dateval == "yesterday" : 620 dateval = (now - 1 ).Format("%Y%m%d235959")624 dateval = (now - 1 + offset).Format("%Y%m%d235959") 621 625 elif dateval == "today" : 622 dateval = now.Format("%Y%m%d235959")626 dateval = (now + offset).Format("%Y%m%d235959") 623 627 elif dateval == "now" : 624 dateval = now.Format("%Y%m%d%H%M%S")628 dateval = (now + offset).Format("%Y%m%d%H%M%S") 625 629 else : # tomorrow 626 dateval = (now + 1).Format("%Y%m%d235959") 627 630 dateval = (now + 1 + offset).Format("%Y%m%d235959") 631 break 632 633 if not dateval.isdigit() : 634 dateval = None 635 else : 628 636 lgdateval = len(dateval) 629 637 if lgdateval == 4 : … … 661 669 except : 662 670 dateval = None 663 datedict[limit] = dateval 664 (start, end) = (datedict["start"], datedict["end"]) 665 if start > end : 666 (start, end) = (end, start) 667 return (start, end) 668 else : 669 return (None, None) 671 datedict[limit] = dateval 672 (start, end) = (datedict["start"], datedict["end"]) 673 if start > end : 674 (start, end) = (end, start) 675 return (start, end) 670 676 671 677 def openConnection(pykotatool) : -
pykota/trunk/pykota/storages/ldapstorage.py
r2266 r2276 1340 1340 startdate = extractonly.get("start") 1341 1341 enddate = extractonly.get("end") 1342 for limit in ("start", "end") :1343 try :1344 del extractonly[limit]1345 except KeyError :1346 pass1347 1342 (startdate, enddate) = self.cleanDates(startdate, enddate) 1348 1343 entries = self.retrieveHistory(user, printer, hostname=extractonly.get("hostname"), billingcode=extractonly.get("billingcode"), limit=None, start=startdate, end=enddate) -
pykota/trunk/pykota/version.py
r2268 r2276 22 22 # 23 23 24 __version__ = "1.23alpha 5_unofficial"24 __version__ = "1.23alpha6_unofficial" 25 25 26 26 __doc__ = "PyKota : a complete Printing Quota Solution for CUPS and LPRng."