Changeset 791 for pykota/trunk
- Timestamp:
- 02/10/03 13:07:31 (22 years ago)
- Location:
- pykota/trunk
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/edpykota
r775 r791 17 17 # 18 18 # $Log$ 19 # Revision 1.20 2003/02/10 12:07:30 jalet 20 # Now repykota should output the recorded total page number for each printer too. 21 # 19 22 # Revision 1.19 2003/02/09 13:40:29 jalet 20 23 # typo … … 177 180 if self.isValidName(pname) : 178 181 self.storage.addPrinter(pname) 179 printernames = [ pname]182 printernames = [ (pname, 0) ] 180 183 else : 181 184 raise PyKotaToolError, _("Invalid printer name %s") % pname … … 197 200 self.logger.log_message(_("Hard limit %i is less than soft limit %i, values will be exchanged.") % (hardlimit, softlimit), "warn") 198 201 (softlimit, hardlimit) = (hardlimit, softlimit) 199 for printerin printernames :202 for (printer, printerpagecounter) in printernames : 200 203 if options["prototype"] : 201 204 if options["users"] : -
pykota/trunk/bin/repykota
r775 r791 17 17 # 18 18 # $Log$ 19 # Revision 1.10 2003/02/10 12:07:30 jalet 20 # Now repykota should output the recorded total page number for each printer too. 21 # 19 22 # Revision 1.9 2003/02/09 13:40:29 jalet 20 23 # typo … … 109 112 if not printernames : 110 113 raise PyKotaToolError, _("There's no printer matching %s") % options["printer"] 111 for printerin printernames :114 for (printer, printerpagecounter) in printernames : 112 115 print _("*** Report for %s quota on printer %s") % ((options["users"] and "user") or "group", printer) 113 116 print _("Pages grace time: %idays") % self.config.getGraceDelay() … … 127 130 if total : 128 131 print (" " * 43) + ("Total : %9i" % total) 132 print (" " * 44) + ("Real : %9i" % printerpagecounter) 129 133 print 130 134 -
pykota/trunk/bin/warnpykota
r775 r791 17 17 # 18 18 # $Log$ 19 # Revision 1.8 2003/02/10 12:07:30 jalet 20 # Now repykota should output the recorded total page number for each printer too. 21 # 19 22 # Revision 1.7 2003/02/09 13:40:29 jalet 20 23 # typo … … 107 110 if not printernames : 108 111 raise PyKotaToolError, _("There's no printer matching %s") % options["printer"] 109 for printerin printernames :112 for (printer, printerpagecounter) in printernames : 110 113 if options["users"] : 111 114 for name in self.storage.getPrinterUsers(printer) : -
pykota/trunk/pykota/storage.py
r773 r791 15 15 # 16 16 # $Log$ 17 # Revision 1.7 2003/02/10 12:07:31 jalet 18 # Now repykota should output the recorded total page number for each printer too. 19 # 17 20 # Revision 1.6 2003/02/09 13:05:43 jalet 18 21 # Internationalization continues... … … 48 51 """Base class for all storages.""" 49 52 def getMatchingPrinters(self, printerpattern) : 50 """Returns the list of all printer names which match a certain pattern."""53 """Returns the list of all printers tuples (name, pagecounter) which match a certain pattern for the printer name.""" 51 54 pass 52 55 -
pykota/trunk/pykota/storages/sql.py
r784 r791 15 15 # 16 16 # $Log$ 17 # Revision 1.18 2003/02/10 12:07:31 jalet 18 # Now repykota should output the recorded total page number for each printer too. 19 # 17 20 # Revision 1.17 2003/02/10 08:41:36 jalet 18 21 # edpykota's --reset command line option resets the limit date too. … … 77 80 class SQLStorage : 78 81 def getMatchingPrinters(self, printerpattern) : 79 """Returns the list of all printer names which match a certain pattern."""82 """Returns the list of all printers tuples (name, pagecounter) which match a certain pattern for the printer name.""" 80 83 printerslist = [] 81 84 # We 'could' do a SELECT printername FROM printers WHERE printername LIKE ... 82 85 # but we don't because other storages semantics may be different, so every 83 86 # storage should use fnmatch to match patterns and be storage agnostic 84 result = self.doQuery("SELECT printername FROM printers;")87 result = self.doQuery("SELECT printername, pagecounter FROM printers;") 85 88 result = self.doParseResult(result) 86 89 if result is not None : 87 90 for printer in result : 88 91 if fnmatch.fnmatchcase(printer["printername"], printerpattern) : 89 printerslist.append( printer["printername"])92 printerslist.append((printer["printername"], printer["pagecounter"])) 90 93 return printerslist 91 94 … … 96 99 def getPrinterUsers(self, printername) : 97 100 """Returns the list of usernames which uses a given printer.""" 98 result = self.doQuery("SELECT DISTINCT username FROM users WHERE id IN (SELECT userid FROM userpquota WHERE printerid IN (SELECT printerid FROM printers WHERE printername=%s)) ;" % self.doQuote(printername))101 result = self.doQuery("SELECT DISTINCT username FROM users WHERE id IN (SELECT userid FROM userpquota WHERE printerid IN (SELECT printerid FROM printers WHERE printername=%s)) ORDER BY username;" % self.doQuote(printername)) 99 102 result = self.doParseResult(result) 100 103 if result is None :