Changeset 887 for pykota/trunk
- Timestamp:
- 04/08/03 22:38:08 (22 years ago)
- Location:
- pykota/trunk
- Files:
-
- 7 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/pykota
r873 r887 23 23 # 24 24 # $Log$ 25 # Revision 1.16 2003/04/08 20:38:08 jalet 26 # The last job Id is saved now for each printer, this will probably 27 # allow other accounting methods in the future. 28 # 25 29 # Revision 1.15 2003/03/29 13:45:27 jalet 26 30 # GPL paragraphs were incorrectly (from memory) copied into the sources. … … 131 135 132 136 # 137 # According to CUPS documentation, the job id is the second command line argument 138 jobid = sys.argv[1].strip() 139 140 # 133 141 # According to CUPS documentation, the username is the third command line argument 134 142 username = sys.argv[2].strip() … … 155 163 else : 156 164 # get last values from Quota Storage 157 (lastpagecounter, last username) = (pgc["pagecounter"], pgc["lastusername"])165 (lastpagecounter, lastjobid, lastusername) = (pgc["pagecounter"], pgc["lastjobid"], pgc["lastusername"]) 158 166 159 167 # if printer is off then we assume the correct counter value is the last one … … 163 171 # Update the last page counter and last username in the Quota Storage backend 164 172 # set them to current user and 165 kotafilter.storage.updatePrinterPageCounter(kotafilter.printername, username, counterbeforejob )173 kotafilter.storage.updatePrinterPageCounter(kotafilter.printername, username, counterbeforejob, jobid) 166 174 167 175 # Was the printer ever used ? -
pykota/trunk/initscripts/pykota-postgresql.sql
r873 r887 20 20 -- 21 21 -- $Log$ 22 -- Revision 1.7 2003/04/08 20:38:08 jalet 23 -- The last job Id is saved now for each printer, this will probably 24 -- allow other accounting methods in the future. 25 -- 22 26 -- Revision 1.6 2003/03/29 13:45:27 jalet 23 27 -- GPL paragraphs were incorrectly (from memory) copied into the sources. … … 84 88 CREATE TABLE printers(id SERIAL PRIMARY KEY NOT NULL, 85 89 printername TEXT UNIQUE NOT NULL, 90 lastjobid TEXT, 86 91 lastusername TEXT, 87 92 pagecounter INT4 DEFAULT 0); -
pykota/trunk/initscripts/README
r873 r887 22 22 This directory contains scripts to initialise the PyKota 23 23 storage database. Use the one which best suits your need 24 depending on the storage backend you want to use. Each 25 script has an associated README file, be sure to read 26 this as well : 24 depending on the storage backend you want to use. 27 25 28 File Backend 29 -------------------------------------------------- 30 pykota-posgresql.sql | PostgreSQL storage 31 pykota-upgrade-postgresql.sql | Upgrade database schema from pre 1.01 32 | 33 34 ============================================================ 26 27 Files : 28 ======= 29 30 * pykota-postgresql.sql : 31 32 This file creates an empty Quota Storage Database, using PostgreSQL 33 as a backend. You have to use it the first time you install PyKota 34 if you want to use PostgreSQL as the Quota Storage Backend. 35 36 * pykota-upgrade-postgresql.sql : 37 38 This files upgrades the PostgreSQL Quota Storage Database schema 39 from versions before 1.01 to version 1.01. 40 41 * upgrade-1.01-to-1.03.sh : 42 43 This shell script upgrades the PostgreSQL Quota Storage Database schema 44 from versions 1.01 or 1.02 to version 1.03. 45 PLEASE DO A BACKUP OF YOUR PYKOTA DATABASE BEFORE RUNNING THIS SCRIPT ! 46 Also this script will try to connect to PostgreSQL as the postgres user 47 (i.e. PostgreSQL's administrator), on the local machine (PyKota Storage 48 Server), without prompting for a password. Please read this script and 49 adapt it to your own configuration before running it. THIS IS IMPORTANT. 50 -
pykota/trunk/initscripts/README.postgresql
r880 r887 27 27 28 28 If you have already installed PyKota, and have datas in your 29 Quota Storage DataBase, you may prefer to 29 Quota Storage DataBase, you may prefer to skip this section 30 30 and read the next one. 31 31 … … 49 49 ============================================================ 50 50 51 Upgrade script :51 Upgrade scripts : 52 52 53 An sql script to upgrade a pre-1.01 PyKota Quota Storage 54 DataBase is included, if you want to keep your datas from 55 a pre-1.01 PyKota version, then please launch the following 56 commands : 53 Some scripts to upgrade old PyKota databases to the new 54 database schema are included. You may have to run all 55 of them or only some of them, depending on your 56 version of PyKota. 57 58 * An sql script to upgrade a pre-1.01 PyKota Quota Storage DataBase to 59 1.01 is included. If your PyKota version is equal or higher than 1.01 then 60 you can skip to the next section. Otherwise, if you want to keep your datas 61 from a pre-1.01 PyKota version, then please launch the following commands : 57 62 58 63 - Launch the psql frontend and connect to the … … 76 81 to run this upgrade script. 77 82 78 WARNING :83 WARNING : 79 84 80 85 This script requires a recent version of PostgreSQL to run … … 85 90 fields are pagecounter and lifepagecounter, just forgot them. 86 91 87 IMPORTANT : 88 89 Because the modifications are just about Group Print Quotas 90 and because Group Print Quotas are currently not fully 91 implemented, you can delay the launch of this upgrade 92 script until you really need Group Print Quotas. 93 In other terms, running this script is not mandatory 94 for PyKota to continue to work correctly, at least 95 until Group Print Quotas will be fully implemented. 96 92 * If you are already running PyKota 1.01 or 1.02 and want to upgrade to 93 1.03, YOU HAVE TO RUN the upgrade-1.01-to-1.03.sh shell script. 94 NOT LAUNCHING THIS SCRIPT WILL CAUSE PYKOTA TO STOP WORKING ! 95 Please don't run this script if your version of PyKota is already 96 1.03 or higher. -
pykota/trunk/NEWS
r885 r887 24 24 - 1.03alpha : 25 25 26 - IMPORTANT : DataBase schema has changed, YOU HAVE TO 27 UPGRADE using the upgrade-1.01-to-1.03.sh script. 28 Please read initscripts/README first and then 29 read initscripts/README.postgresql 30 26 31 - The installation script now allows to install the sample 27 32 configuration file during first installation. -
pykota/trunk/pykota/storages/sql.py
r873 r887 21 21 # 22 22 # $Log$ 23 # Revision 1.21 2003/04/08 20:38:08 jalet 24 # The last job Id is saved now for each printer, this will probably 25 # allow other accounting methods in the future. 26 # 23 27 # Revision 1.20 2003/03/29 13:45:27 jalet 24 28 # GPL paragraphs were incorrectly (from memory) copied into the sources. … … 148 152 def getPrinterPageCounter(self, printername) : 149 153 """Returns the last page counter value for a printer given its name.""" 150 result = self.doQuery("SELECT pagecounter, last username FROM printers WHERE printername=%s;" % self.doQuote(printername))154 result = self.doQuery("SELECT pagecounter, lastjobid, lastusername FROM printers WHERE printername=%s;" % self.doQuote(printername)) 151 155 try : 152 156 return self.doParseResult(result)[0] … … 154 158 return 155 159 156 def updatePrinterPageCounter(self, printername, username, pagecount ) :157 """Updates the last page counter information for a printer given its name, last username and pagecount."""158 return self.doQuery("UPDATE printers SET pagecounter=%s, lastusername=%s WHERE printername=%s;" % (self.doQuote(pagecount), self.doQuote(username), self.doQuote(printername)))160 def updatePrinterPageCounter(self, printername, username, pagecount, jobid) : 161 """Updates the last page counter information for a printer given its name, last username, pagecount and jobid.""" 162 return self.doQuery("UPDATE printers SET pagecounter=%s, lastusername=%s, lastjobid=%s WHERE printername=%s;" % (self.doQuote(pagecount), self.doQuote(username), self.doQuote(jobid), self.doQuote(printername))) 159 163 160 164 def addUserPQuota(self, username, printername) : -
pykota/trunk/README
r882 r887 110 110 ============= 111 111 112 WARNING : 113 ========= 114 115 If you run a PyKota version lower than 1.01, you definitely have to 116 upgrade you Quota Storage Database. Please read the documentation 117 included in the initscripts subdirectory first ! 118 112 119 Prerequisite : 113 120 --------------