Changeset 1376 for pykota/trunk/bin
- Timestamp:
- 03/01/04 16:06:51 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/pykota
r1359 r1376 24 24 # 25 25 # $Log$ 26 # Revision 1.54 2004/03/01 15:06:51 jalet 27 # Pre and Post hooks should now work in the pykota filter too. 28 # The pykota filter doesn't check the last user's quota anymore 29 # when delayed hardware accounting is used : this will be checked 30 # anyway the next time the last user will print 31 # 26 32 # Revision 1.53 2004/02/25 12:36:34 jalet 27 33 # Avoids a database query even if caching was disabled. … … 250 256 # be allowed if current user is allowed to print on this printer 251 257 if policy == "OK" : 258 # exports user information with initial values 259 self.exportUserInfo(userpquota) 260 261 # enters first phase 262 os.putenv("PYKOTAPHASE", "BEFORE") 263 252 264 self.logdebug("Does accounting for user %s on printer %s." % (user.Name, printer.Name)) 253 265 action = self.accounter.doAccounting(userpquota) 266 267 # exports some new environment variables 268 os.putenv("PYKOTAACTION", action) 269 270 # launches the pre hook 271 self.prehook(userpquota) 254 272 else : 255 273 action = "ALLOW" … … 302 320 lastjobsize = self.accounter.getJobSize() 303 321 self.logdebug("Last Job size : %i" % lastjobsize) 304 printer.LastJob.setSize(lastuserpquota, lastjobsize)322 lastjobprice = printer.LastJob.setSize(lastuserpquota, lastjobsize) 305 323 self.logdebug("Updating user %s's quota on printer %s" % (lastuserpquota.User.Name, printer.Name)) 306 324 lastuserpquota.increasePagesUsage(lastjobsize) 307 self.warnUserPQuota(lastuserpquota) 325 326 # exports user information with final values 327 self.exportUserInfo(lastuserpquota) 328 329 # enters final phase 330 os.putenv("PYKOTAPHASE", "AFTER") 331 os.putenv("PYKOTAACTION", printer.LastJob.JobAction) 332 os.putenv("PYKOTAJOBSIZE", str(lastjobsize)) 333 os.putenv("PYKOTAJOBPRICE", str(lastjobprice)) 334 335 # launches the post hook 336 self.posthook(lastuserpquota) 337 338 # Code below deactivated since this will be checked 339 # anyway the next time this user prints 340 # finally check last user's quota 341 # self.warnUserPQuota(lastuserpquota) 308 342 309 343 # then deal with current print job as usual