Changeset 709 for pykota/trunk
- Timestamp:
- 02/06/03 00:45:09 (22 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/tool.py
r708 r709 15 15 # 16 16 # $Log$ 17 # Revision 1.5 2003/02/05 23:45:09 jalet 18 # Better DateTime manipulation wrt grace delay 19 # 17 20 # Revision 1.4 2003/02/05 23:26:22 jalet 18 21 # Incorrect handling of grace delay … … 86 89 hardlimit = quota["hardlimit"] 87 90 datelimit = quota["datelimit"] 88 if datelimit :89 datelimit = DateTime. DateTime(datelimit) # TODO : check this !91 if datelimit is not None : 92 datelimit = DateTime.ISO.ParseDateTime(datelimit) 90 93 if softlimit is not None : 91 94 if pagecounter < softlimit : 92 95 action = "ALLOW" 93 96 elif hardlimit is not None : 97 gracedelay = self.config.getGraceDelay() 94 98 if softlimit <= pagecounter < hardlimit : 95 99 if datelimit is None : 96 self.storage.doQuery("UPDATE userpquota SET datelimit=%s::DATETIME WHERE userid=%s AND printerid=%s;" % (self.doQuote("%04i-%02i-%02i %02i:%02i" % (now.year, now.month, now.day, now.hour, now.minute)), self.doQuote(self.getUserId(username)), self.doQuote(self.getPrinterId(printername))))97 datelimit = now98 if (now - datelimit) <= self.config.getGraceDelay():100 datelimit = now + gracedelay 101 self.storage.doQuery("UPDATE userpquota SET datelimit=%s::DATETIME WHERE userid=%s AND printerid=%s;" % (self.doQuote("%04i-%02i-%02i %02i:%02i:%02i" % (datelimit.year, datelimit.month, datelimit.day, datelimit.hour, datelimit.minute, datelimit.second)), self.doQuote(self.getUserId(username)), self.doQuote(self.getPrinterId(printername)))) 102 if (now + gracedelay) < datelimit : 99 103 action = "WARN" 100 104 else : … … 110 114 def warnQuotaPrinter(self, username) : 111 115 """Checks a user quota and send him a message if quota is exceeded on current printer.""" 112 (action, grace, gracedate) = self. storage.checkUserPQuota(username, self.printername)116 (action, grace, gracedate) = self.checkUserPQuota(username, self.printername) 113 117 if action == "DENY" : 114 118 adminmessage = "Print Quota exceeded for user %s on printer %s" % (username, self.printername)