Changeset 722 for pykota/trunk

Show
Ignore:
Timestamp:
02/06/03 16:03:11 (22 years ago)
Author:
jalet
Message:

added a method to set the limit date

Location:
pykota/trunk/pykota
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/storages/sql.py

    r721 r722  
    1515# 
    1616# $Log$ 
     17# Revision 1.10  2003/02/06 15:03:11  jalet 
     18# added a method to set the limit date 
     19# 
    1720# Revision 1.9  2003/02/06 14:52:35  jalet 
    1821# Forgotten import 
     
    123126            self.doQuery("UPDATE userpquota SET softlimit=%s, hardlimit=%s, datelimit=NULL WHERE userid=%s AND printerid=%s;" % (self.doQuote(softlimit), self.doQuote(hardlimit), self.doQuote(userid), self.doQuote(printerid))) 
    124127         
     128    def setDateLimit(username, printername, datelimit) : 
     129        """Sets the limit date for a soft limit to become an hard one given (username, printername).""" 
     130        (userid, printerid) = self.getUPIds(username, printername) 
     131        if (userid is not None) and (printerid is not None) : 
     132            self.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(userid), self.doQuote(printerid))) 
     133         
    125134    def updateUserPQuota(self, username, printername, pagecount) : 
    126135        """Updates the used user Quota information given (username, printername) and a job size in pages.""" 
  • pykota/trunk/pykota/tool.py

    r715 r722  
    1515# 
    1616# $Log$ 
     17# Revision 1.10  2003/02/06 15:03:11  jalet 
     18# added a method to set the limit date 
     19# 
    1720# Revision 1.9  2003/02/06 10:39:23  jalet 
    1821# Preliminary edpykota work. 
     
    193196                         if datelimit is None : 
    194197                             datelimit = now + gracedelay 
    195                              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)))) 
     198                             self.storage.setDateLimit(username, printername, datelimit) 
    196199                         if (now + gracedelay) < datelimit : 
    197200                             action = "WARN"