Changeset 832 for pykota/trunk/bin
- Timestamp:
- 03/07/03 23:16:57 (22 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/pykota
r826 r832 17 17 # 18 18 # $Log$ 19 # Revision 1.14 2003/03/07 22:16:57 jalet 20 # Algorithmically incorrect : last user quota wasn't updated if current 21 # user wasn't allowed to print. 22 # 19 23 # Revision 1.13 2003/02/27 23:59:28 jalet 20 24 # Stupid bug wrt exception handlingand value conversion … … 148 152 # Update the last page counter and last username in the Quota Storage backend 149 153 # set them to current user and 150 kotafilter.storage.updatePrinterPageCounter(kotafilter.printername, username, counterbeforejob) # TODO : allow or deny users not in quota system, and die cleanly if needed154 kotafilter.storage.updatePrinterPageCounter(kotafilter.printername, username, counterbeforejob) 151 155 156 # Was the printer ever used ? 157 if (lastpagecounter is None) or (lastusername is None) : 158 lastusername = username 159 lastpagecounter = counterbeforejob 160 161 # Update the quota for the previous user on this printer according 162 # to the job size (difference between actual counter and latest one from storage) 163 jobsize = (counterbeforejob - lastpagecounter) 164 if jobsize >= 0 : 165 kotafilter.storage.updateUserPQuota(lastusername, kotafilter.printername, jobsize) 166 kotafilter.warnUserPQuota(lastusername) 167 else : 168 kotafilter.logger.log_message(_("Error in page count value %i for user %s on printer %s") % (jobsize, kotafilter.printername, lastusername), "error") 169 152 170 # Is the current user allowed to print at all ? 171 # if no then die, else proceed. 153 172 action = kotafilter.warnUserPQuota(username) 154 173 if action == "DENY" : 155 174 # No, just die cleanly 156 175 return 1 157 158 # Yes159 if (lastpagecounter is None) or (lastusername is None) :160 lastusername = username161 lastpagecounter = counterbeforejob162 jobsize = (counterbeforejob - lastpagecounter)163 if jobsize >= 0:164 kotafilter.storage.updateUserPQuota(lastusername, kotafilter.printername, jobsize)165 kotafilter.warnUserPQuota(lastusername)166 else :167 kotafilter.logger.log_message(_("Error in page count value %i for user %s on printer %s") % (jobsize, kotafilter.printername, lastusername), "error")168 176 169 177 # pass the job untouched to the underlying layer