Changeset 1376 for pykota

Show
Ignore:
Timestamp:
03/01/04 16:06:51 (21 years ago)
Author:
jalet
Message:

Pre and Post hooks should now work in the pykota filter too.
The pykota filter doesn't check the last user's quota anymore
when delayed hardware accounting is used : this will be checked
anyway the next time the last user will print

Location:
pykota/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pykota

    r1359 r1376  
    2424# 
    2525# $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# 
    2632# Revision 1.53  2004/02/25 12:36:34  jalet 
    2733# Avoids a database query even if caching was disabled. 
     
    250256        #            be allowed if current user is allowed to print on this printer 
    251257        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             
    252264            self.logdebug("Does accounting for user %s on printer %s." % (user.Name, printer.Name)) 
    253265            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) 
    254272        else :         
    255273            action = "ALLOW" 
     
    302320                    lastjobsize = self.accounter.getJobSize() 
    303321                    self.logdebug("Last Job size : %i" % lastjobsize) 
    304                     printer.LastJob.setSize(lastuserpquota, lastjobsize) 
     322                    lastjobprice = printer.LastJob.setSize(lastuserpquota, lastjobsize) 
    305323                    self.logdebug("Updating user %s's quota on printer %s" % (lastuserpquota.User.Name, printer.Name)) 
    306324                    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) 
    308342                     
    309343        # then deal with current print job as usual             
  • pykota/trunk/NEWS

    r1372 r1376  
    2222PyKota NEWS : 
    2323 
     24    - 1.18alpha13 : 
     25     
     26        - Pre and Post hooks are now available in the pykota 
     27          filter as well. 
     28           
     29        - The pykota filter doesn't check last user's quota 
     30          anymore : this will be done anyway the next time 
     31          the last user will print again.  
     32         
    2433    - 1.18alpha12 : 
    2534     
    26         - pre and post hooks to external commands with many  
     35        - Pre and Post hooks to external commands with many  
    2736          many environment variables available are useable  
    2837          from the cupspykota backend. 
  • pykota/trunk/pykota/storage.py

    r1368 r1376  
    2222# 
    2323# $Log$ 
     24# Revision 1.49  2004/03/01 15:06:51  jalet 
     25# Pre and Post hooks should now work in the pykota filter too. 
     26# The pykota filter doesn't check the last user's quota anymore 
     27# when delayed hardware accounting is used : this will be checked 
     28# anyway the next time the last user will print 
     29# 
    2430# Revision 1.48  2004/02/27 13:50:12  jalet 
    2531# Hopefully the final fix for groups (users and printers) 
     
    474480        self.JobSize = jobsize 
    475481        self.JobPrice = jobprice 
     482        return jobprice 
    476483         
    477484class BaseStorage : 
  • pykota/trunk/pykota/version.py

    r1372 r1376  
    2222# 
    2323 
    24 __version__ = "1.18alpha12_unofficial" 
     24__version__ = "1.18alpha13_unofficial" 
    2525 
    2626__doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""