Show
Ignore:
Timestamp:
02/08/03 23:39:46 (21 years ago)
Author:
jalet
Message:

--reset command line option added

Files:
1 modified

Legend:

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

    r765 r768  
    1515# 
    1616# $Log$ 
     17# Revision 1.16  2003/02/08 22:39:46  jalet 
     18# --reset command line option added 
     19# 
    1720# Revision 1.15  2003/02/08 22:12:09  jalet 
    1821# Life time counter for users and groups added. 
     
    135138         
    136139    def addUserPQuota(self, username, printername) : 
     140        """Initializes a user print quota on a printer, adds the printer and the user to the quota storage if needed.""" 
    137141        (userid, printerid) = self.getUPIds(username, printername) 
    138142        if printerid is None :     
     
    152156        (userid, printerid) = self.getUPIds(username, printername) 
    153157        if (userid is not None) and (printerid is not None) : 
    154             result = self.doQuery("SELECT pagecounter, softlimit, hardlimit, datelimit FROM userpquota WHERE userid=%s AND printerid=%s;" % (self.doQuote(userid), self.doQuote(printerid))) 
     158            result = self.doQuery("SELECT lifepagecounter, pagecounter, softlimit, hardlimit, datelimit FROM userpquota WHERE userid=%s AND printerid=%s;" % (self.doQuote(userid), self.doQuote(printerid))) 
    155159            try : 
    156160                return self.doParseResult(result)[0] 
     
    163167        if (userid is not None) and (printerid is not None) : 
    164168            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))) 
     169         
     170    def resetUserPQuota(self, username, printername) :     
     171        """Resets the page counter to zero. Life time page counter is kept unchanged.""" 
     172        (userid, printerid) = self.getUPIds(username, printername) 
     173        if (userid is not None) and (printerid is not None) : 
     174            self.doQuery("UPDATE userpquota SET pagecounter=0 WHERE userid=%s AND printerid=%s;" % (self.doQuote(userid), self.doQuote(printerid))) 
    165175         
    166176    def setDateLimit(self, username, printername, datelimit) :