Changeset 1149

Show
Ignore:
Timestamp:
10/08/03 09:01:20 (21 years ago)
Author:
jalet
Message:

Job history can be disabled.
Some typos in README.
More messages in setup script.

Location:
pykota/trunk
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/conf/pykota.conf.sample

    r1147 r1149  
    6060# 
    6161storagecaching: No 
     62 
     63# Should full job history be disabled ? 
     64# If unset or set to No, full job history is kept in the database. 
     65# This will be useful in the future when the report generator 
     66# will be written. 
     67# Disabling the job history can be useful with heavily loaded 
     68# LDAP servers, to not make the LDAP tree grow out of control. 
     69# Disabling the job history with the PostgreSQL backend works too 
     70# but it's probably less useful than with LDAP. 
     71disablehistory: No 
    6272 
    6373# LDAP example, uncomment and adapt it to your own configuration : 
  • pykota/trunk/NEWS

    r1138 r1149  
    2222PyKota NEWS : 
    2323 
     24    - 1.15alpha8 : 
     25     
     26        - Job history can be disabled if needed. 
     27          This feature may be useful for people who use the LDAP 
     28          backend and don't want their LDAP tree to grow out of 
     29          control. 
     30         
    2431    - 1.15alpha7 :  
    2532     
  • pykota/trunk/pykota/storages/ldapstorage.py

    r1147 r1149  
    2222# 
    2323# $Log$ 
     24# Revision 1.33  2003/10/08 07:01:20  jalet 
     25# Job history can be disabled. 
     26# Some typos in README. 
     27# More messages in setup script. 
     28# 
    2429# Revision 1.32  2003/10/07 14:23:25  jalet 
    2530# More work on cache 
     
    664669    def writeJobNew(self, printer, user, jobid, pagecounter, action, jobsize=None) :     
    665670        """Adds a job in a printer's history.""" 
    666         uuid = self.genUUID() 
     671        if (not self.disablehistory) or (not printer.LastJob.Exists) : 
     672            uuid = self.genUUID() 
     673            dn = "cn=%s,%s" % (uuid, self.info["jobbase"]) 
     674        else :     
     675            uuid = printer.LastJob.ident[3:].split(",")[0] 
     676            dn = printer.LastJob.ident 
    667677        fields = { 
    668678                   "objectClass" : ["pykotaObject", "pykotaJob"], 
     
    674684                   "pykotaAction" : action, 
    675685                 } 
    676         if jobsize is not None :          
     686        if (not self.disablehistory) or (not printer.LastJob.Exists) : 
     687            if jobsize is not None :          
     688                fields.update({ "pykotaJobSize" : str(jobsize) }) 
     689            self.doAdd(dn, fields) 
     690        else :     
     691            # here we explicitly want to reset jobsize to 'None' if needed 
    677692            fields.update({ "pykotaJobSize" : str(jobsize) }) 
    678         dn = "cn=%s,%s" % (uuid, self.info["jobbase"]) 
    679         self.doAdd(dn, fields) 
     693            self.doModify(dn, fields) 
     694             
    680695        if printer.LastJob.Exists : 
    681696            fields = { 
  • pykota/trunk/pykota/storages/pgstorage.py

    r1144 r1149  
    2222# 
    2323# $Log$ 
     24# Revision 1.19  2003/10/08 07:01:20  jalet 
     25# Job history can be disabled. 
     26# Some typos in README. 
     27# More messages in setup script. 
     28# 
    2429# Revision 1.18  2003/10/07 09:07:30  jalet 
    2530# Character encoding added to please latest version of Python 
     
    420425    def writeJobNew(self, printer, user, jobid, pagecounter, action, jobsize=None) :     
    421426        """Adds a job in a printer's history.""" 
    422         if jobsize is not None : 
    423             self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action, jobsize) VALUES (%s, %s, %s, %s, %s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize))) 
    424         else :     
    425             self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action) VALUES (%s, %s, %s, %s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action))) 
     427        if (not self.disablehistory) or (not printer.LastJob.Exists) : 
     428            if jobsize is not None : 
     429                self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action, jobsize) VALUES (%s, %s, %s, %s, %s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize))) 
     430            else :     
     431                self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action) VALUES (%s, %s, %s, %s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action))) 
     432        else :         
     433            # here we explicitly want to reset jobsize to NULL if needed 
     434            self.doModify("UPDATE jobhistory SET userid=%s, jobid=%s, pagecounter=%s, action=%s, jobsize=%s, jobdate=now() WHERE id=%s;" % (self.doQuote(user.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize), self.doQuote(printer.LastJob.ident))) 
    426435             
    427436    def writeUserPQuotaLimits(self, userpquota, softlimit, hardlimit) : 
  • pykota/trunk/pykota/version.py

    r1144 r1149  
    2222# 
    2323 
    24 __version__ = "1.15alpha7_unofficial" 
     24__version__ = "1.15alpha8_unofficial" 
    2525 
    2626__doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng.""" 
  • pykota/trunk/README

    r1107 r1149  
    7878           
    7979        - Complete job history is saved. This will allow more 
    80           complex reports in the future. 
     80          complex reports in the future. This can be disabled 
     81          if preserving the history is of no interest or 
     82          makes the database grow out of control. 
    8183           
    8284        - Price per page and price per job can be defined for   
     
    298300printing quota. 
    299301 
    300 To see printer command usage, you can use : 
     302To see printer quota usage, you can use : 
    301303 
    302304    $ repykota --printer lp 
  • pykota/trunk/setup.py

    r1144 r1149  
    2424# 
    2525# $Log$ 
     26# Revision 1.25  2003/10/08 07:01:19  jalet 
     27# Job history can be disabled. 
     28# Some typos in README. 
     29# More messages in setup script. 
     30# 
    2631# Revision 1.24  2003/10/07 09:07:27  jalet 
    2732# Character encoding added to please latest version of Python 
     
    163168            return ACTION_ABORT 
    164169     
    165 if "install" in sys.argv : 
     170if ("install" in sys.argv) and not ("help" in sys.argv) : 
    166171    # checks if Python version is correct, we need >= 2.1 
    167172    if not (sys.version > "2.1") : 
     
    268273                sys.stderr.write("INSTALLATION ABORTED BECAUSE CONFIGURATION INCOMPLETE.\n") 
    269274                sys.exit(-1) 
    270          
     275                 
     276        # Say something about caching mechanism and disabling job history 
     277        sys.stdout.write("You can now activate the database caching mechanism\nwhich is disabled by default.\nIt is especially recommanded with the LDAP backend.\n") 
     278        sys.stdout.write("You can now disable the preservation of the complete\njob history which is enabled by default.\nIt is probably more useful with the LDAP backend.\n") 
     279        sys.stdout.write("PLEASE LOOK AT THE SAMPLE CONFIGURATION FILE conf/pykota.conf.sample\n") 
     280        sys.stdout.write("TO LEARN HOW TO DO\n") 
     281        dummy = raw_input("Please press ENTER when you have read the message above. ") 
     282        sys.stdout.write("\n") 
     283             
    271284    # change files permissions     
    272285    os.chmod("/etc/pykota/pykota.conf", 0644) 
     
    279292    sys.stdout.write("PLEASE READ DOCUMENTATION IN initscripts/postgresql/ TO LEARN HOW TO DO.\n") 
    280293    sys.stdout.write("YOU CAN DO THAT AFTER THE INSTALLATION IS FINISHED, OR PRESS CTRL+C NOW.\n") 
    281     sys.stdout.write("\n\nYOU DON'T HAVE ANYTHING SPECIAL TO DO IF THIS IS YOUR FIRST INSTALLATION.\n\n") 
     294    sys.stdout.write("\n\nYOU DON'T HAVE ANYTHING SPECIAL TO DO IF THIS IS YOUR FIRST INSTALLATION\nOR IF YOU ARE ALREADY RUNNING VERSION 1.14 OR ABOVE.\n\n") 
    282295    dummy = raw_input("Please press ENTER when you have read the message above. ") 
    283296