Changeset 1079
- Timestamp:
- 07/09/03 22:17:07 (21 years ago)
- Location:
- pykota/trunk
- Files:
-
- 1 added
- 6 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/initscripts/postgresql/pykota-postgresql.sql
r1021 r1079 20 20 -- 21 21 -- $Log$ 22 -- Revision 1.3 2003/07/09 20:17:07 jalet 23 -- Email field added to PostgreSQL schema 24 -- 22 25 -- Revision 1.2 2003/06/10 16:37:54 jalet 23 26 -- Deletion of the second user which is not needed anymore. … … 59 62 CREATE TABLE users(id SERIAL PRIMARY KEY NOT NULL, 60 63 username TEXT UNIQUE NOT NULL, 64 email TEXT, 61 65 balance FLOAT DEFAULT 0.0, 62 66 lifetimepaid FLOAT DEFAULT 0.0, -
pykota/trunk/initscripts/postgresql/README.postgresql
r1046 r1079 56 56 version of PyKota. 57 57 58 * An sql script to upgrade a pre-1.01 PyKota Quota Storage DataBase to59 1.01 is still included for historical reasons. PLEASE DON'T USE IT !60 58 61 * If you are already running an old version of PyKota (<1.03) and 62 want to upgrade to 1.03, YOU HAVE TO RUN the 63 upgrade-from-before-1.03.py shell script. NOT LAUNCHING THIS SCRIPT 64 WILL CAUSE PYKOTA TO STOP WORKING ! PLEASE NEVER RUN THIS SCRIPT IF 65 YOUR EXISTING VERSION OF PYKOTA IS ALREADY 1.03 OR HIGHER. 59 * An SQL script to upgrade a pre-1.14 PyKota Storage DataBase to 60 1.14 is included. Launch it this way on the Quota Storage Server : 61 62 $ psql -U postgres pykota 63 pykota=# \i upgrade-to-1.14.sql 64 pykota=# \q 65 $ 66 67 This script adds an "email" field for each user. This field, if not 68 NULL, is used as the email address of the user when sending warning 69 messages in case he is over quota. 70 71 What is below is for historical reasons only, real people don't use 72 such old beasts, and YOU SHOULDN'T EITHER ! 73 74 * An sql script to upgrade a pre-1.01 PyKota Quota Storage DataBase to 75 1.01 is still included for historical reasons. PLEASE DON'T USE IT ! 76 77 * If you are already running an old version of PyKota (<1.03) and 78 want to upgrade to 1.03, YOU HAVE TO RUN the 79 upgrade-from-before-1.03.py shell script. NOT LAUNCHING THIS SCRIPT 80 WILL CAUSE PYKOTA TO STOP WORKING ! PLEASE NEVER RUN THIS SCRIPT IF 81 YOUR EXISTING VERSION OF PYKOTA IS ALREADY 1.03 OR HIGHER. -
pykota/trunk/NEWS
r1078 r1079 22 22 PyKota NEWS : 23 23 24 - 1.14alpha3 : 25 26 - Email field added to PostgreSQL database. An upgrade script 27 is included in initscripts/postgresql. 28 24 29 - 1.14alpha2 : 25 30 -
pykota/trunk/pykota/storages/pgstorage.py
r1068 r1079 21 21 # 22 22 # $Log$ 23 # Revision 1.7 2003/07/09 20:17:07 jalet 24 # Email field added to PostgreSQL schema 25 # 23 26 # Revision 1.6 2003/07/07 11:49:24 jalet 24 27 # Lots of small fixes with the help of PyChecker … … 283 286 """Returns the list of users who uses a given printer, along with their quotas.""" 284 287 usersandquotas = [] 285 result = self.doSearch("SELECT users.id as uid,username,balance,lifetimepaid,limitby, userpquota.id,lifepagecounter,pagecounter,softlimit,hardlimit,datelimit FROM users JOIN userpquota ON users.id=userpquota.userid AND printerid=%s ORDER BY username ASC" % self.doQuote(printer.ident))288 result = self.doSearch("SELECT users.id as uid,username,balance,lifetimepaid,limitby,email,userpquota.id,lifepagecounter,pagecounter,softlimit,hardlimit,datelimit FROM users JOIN userpquota ON users.id=userpquota.userid AND printerid=%s ORDER BY username ASC" % self.doQuote(printer.ident)) 286 289 if result : 287 290 for record in result : … … 292 295 user.AccountBalance = record.get("balance") 293 296 user.LifeTimePaid = record.get("lifetimepaid") 294 user.Email = record.get("email") # TODO : Always None here297 user.Email = record.get("email") 295 298 user.Exists = 1 296 299 userpquota = StorageUserPQuota(self, user, printer) -
pykota/trunk/pykota/tool.py
r1077 r1079 21 21 # 22 22 # $Log$ 23 # Revision 1.46 2003/07/09 20:17:07 jalet 24 # Email field added to PostgreSQL schema 25 # 23 26 # Revision 1.45 2003/07/08 19:43:51 jalet 24 27 # Configurable warning messages. … … 327 330 server.quit() 328 331 329 def sendMessageToUser(self, admin, adminmail, user name, subject, message) :332 def sendMessageToUser(self, admin, adminmail, user, subject, message) : 330 333 """Sends an email message to a user.""" 331 334 message += _("\n\nPlease contact your system administrator :\n\n\t%s - <%s>\n") % (admin, adminmail) 332 self.sendMessage(adminmail, user name, "Subject: %s\n\n%s" % (subject, message))335 self.sendMessage(adminmail, user.Email or user.Name, "Subject: %s\n\n%s" % (subject, message)) 333 336 334 337 def sendMessageToAdmin(self, adminmail, subject, message) : … … 477 480 for user in self.storage.getGroupMembers(group) : 478 481 if mailto in [ "BOTH", "USER" ] : 479 self.sendMessageToUser(admin, adminmail, user .Name, _("Print Quota Exceeded"), self.config.getHardWarn(printer.Name))482 self.sendMessageToUser(admin, adminmail, user, _("Print Quota Exceeded"), self.config.getHardWarn(printer.Name)) 480 483 elif action == "WARN" : 481 484 adminmessage = _("Print Quota soft limit exceeded for group %s on printer %s") % (group.Name, printer.Name) … … 489 492 for user in self.storage.getGroupMembers(group) : 490 493 if mailto in [ "BOTH", "USER" ] : 491 self.sendMessageToUser(admin, adminmail, user .Name, _("Print Quota Exceeded"), message)494 self.sendMessageToUser(admin, adminmail, user, _("Print Quota Exceeded"), message) 492 495 return action 493 496 … … 506 509 self.logger.log_message(adminmessage) 507 510 if mailto in [ "BOTH", "USER" ] : 508 self.sendMessageToUser(admin, adminmail, user .Name, _("Print Quota Exceeded"), self.config.getHardWarn(printer.Name))511 self.sendMessageToUser(admin, adminmail, user, _("Print Quota Exceeded"), self.config.getHardWarn(printer.Name)) 509 512 if mailto in [ "BOTH", "ADMIN" ] : 510 513 self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage) … … 517 520 else : 518 521 message = self.config.getSoftWarn(printer.Name) 519 self.sendMessageToUser(admin, adminmail, user .Name, _("Print Quota Low"), message)522 self.sendMessageToUser(admin, adminmail, user, _("Print Quota Low"), message) 520 523 if mailto in [ "BOTH", "ADMIN" ] : 521 524 self.sendMessageToAdmin(adminmail, _("Print Quota"), adminmessage) -
pykota/trunk/pykota/version.py
r1078 r1079 21 21 # 22 22 23 __version__ = "1.14alpha 2_unofficial"23 __version__ = "1.14alpha3_unofficial" 24 24 25 25 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""