- Timestamp:
- 02/09/03 13:56:53 (22 years ago)
- Location:
- pykota/trunk
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/edpykota
r769 r772 17 17 # 18 18 # $Log$ 19 # Revision 1.18 2003/02/09 12:56:53 jalet 20 # Internationalization begins... 21 # 19 22 # Revision 1.17 2003/02/08 22:47:23 jalet 20 23 # Option --reset can now be used without having to use soft and hard limits … … 173 176 printernames = [ pname ] 174 177 else : 175 raise PyKotaToolError, "Invalid printer name %s"% pname178 raise PyKotaToolError, _("Invalid printer name %s") % pname 176 179 else : 177 raise PyKotaToolError, "There's no printer matching %s"% pname180 raise PyKotaToolError, _("There's no printer matching %s") % pname 178 181 softlimit = hardlimit = None 179 182 if options["softlimit"] : … … 181 184 softlimit = int(options["softlimit"].strip()) 182 185 except ValueError : 183 raise PyKotaToolError, "Invalid softlimit value %s."% options["softlimit"]186 raise PyKotaToolError, _("Invalid softlimit value %s.") % options["softlimit"] 184 187 if options["hardlimit"] : 185 188 try : 186 189 hardlimit = int(options["hardlimit"].strip()) 187 190 except ValueError : 188 raise PyKotaToolError, "Invalid hardlimit value %s."% options["hardlimit"]191 raise PyKotaToolError, _("Invalid hardlimit value %s.") % options["hardlimit"] 189 192 if (softlimit is not None) and (hardlimit is not None) and (hardlimit < softlimit) : 190 193 # error, exchange them 191 self.logger.log_message( "Hard limit %i is less than soft limit %i, values will be exchanged."% (hardlimit, softlimit), "warn")194 self.logger.log_message(_("Hard limit %i is less than soft limit %i, values will be exchanged.") % (hardlimit, softlimit), "warn") 192 195 (softlimit, hardlimit) = (hardlimit, softlimit) 193 196 for printer in printernames : … … 198 201 prototype = self.storage.getGroupPQuota(options["prototype"], printer) 199 202 if prototype is None : 200 self.logger.log_message( "Prototype %s not found in Quota Storage for printer %s."% (options["prototype"], printer))203 self.logger.log_message(_("Prototype %s not found in Quota Storage for printer %s.") % (options["prototype"], printer)) 201 204 continue # skip this printer 202 205 else : … … 204 207 if hardlimit is None : 205 208 hardlimit = softlimit 206 self.logger.log_message( "Undefined hard limit set to soft limit (%s) on printer %s."% (str(hardlimit), printer))209 self.logger.log_message(_("Undefined hard limit set to soft limit (%s) on printer %s.") % (str(hardlimit), printer)) 207 210 if softlimit is None : 208 211 softlimit = hardlimit 209 self.logger.log_message( "Undefined soft limit set to hard limit (%s) on printer %s."% (str(softlimit), printer))212 self.logger.log_message(_("Undefined soft limit set to hard limit (%s) on printer %s.") % (str(softlimit), printer)) 210 213 if (not options["reset"]) and ((hardlimit is None) or (softlimit is None)) : 211 raise PyKotaToolError, "Both hard and soft limits must be set ! Aborting."214 raise PyKotaToolError, _("Both hard and soft limits must be set ! Aborting.") 212 215 for name in names : 213 216 if options["users"] : … … 227 230 quota = self.storage.getUserPQuota(name, printer) 228 231 else : 229 self.logger.log_message( "Invalid user name %s"% name)232 self.logger.log_message(_("Invalid user name %s") % name) 230 233 else : 231 234 if self.isValidName(name) : … … 233 236 quota = self.storage.getGroupPQuota(name, printer) 234 237 else : 235 self.logger.log_message( "Invalid group name %s"% name)238 self.logger.log_message(_("Invalid group name %s") % name) 236 239 if quota is None : 237 self.logger.log_message( "Quota not found for object %s on printer %s."% (name, printer))240 self.logger.log_message(_("Quota not found for object %s on printer %s.") % (name, printer)) 238 241 else : 239 242 if options["users"] : … … 281 284 editor.display_version_and_quit() 282 285 elif options["users"] and options["groups"] : 283 raise PyKotaToolError, "edpykota: options --users and --groups are incompatible."286 raise PyKotaToolError, _("edpykota: options --users and --groups are incompatible.") 284 287 elif (options["softlimit"] or options["hardlimit"]) and options["prototype"] : 285 raise PyKotaToolError, "edpykota: options --softlimit or --hardlimit and --prototype are incompatible."288 raise PyKotaToolError, _("edpykota: options --softlimit or --hardlimit and --prototype are incompatible.") 286 289 elif options["groups"] : 287 raise PyKotaToolError, "edpykota: options --groups is currently not implemented."290 raise PyKotaToolError, _("edpykota: options --groups is currently not implemented.") 288 291 else : 289 292 sys.exit(editor.main(args, options)) -
pykota/trunk/bin/pykota
r740 r772 17 17 # 18 18 # $Log$ 19 # Revision 1.8 2003/02/09 12:56:53 jalet 20 # Internationalization begins... 21 # 19 22 # Revision 1.7 2003/02/07 10:23:48 jalet 20 23 # Avoid a possible future name clash … … 75 78 else : 76 79 infile = sys.stdin 77 data = infile.read( 65536)80 data = infile.read(256*1024) 78 81 while data : 79 82 sys.stdout.write(data) 80 data = infile.read( 65536)83 data = infile.read(256*1024) 81 84 if mustclose : 82 85 infile.close() … … 112 115 # The printer is unknown from the Quota Storage perspective 113 116 # we let the job pass through, but log a warning message 114 kotafilter.logger.log_message( "Printer %s not registered in the PyKota system"% kotafilter.printername, "warn")117 kotafilter.logger.log_message(_("Printer %s not registered in the PyKota system") % kotafilter.printername, "warn") 115 118 else : 116 119 (lastpagecounter, lastusername) = (pgc["pagecounter"], pgc["lastusername"]) … … 135 138 kotafilter.warnUserPQuota(lastusername) 136 139 else : 137 kotafilter.logger.log_message( "Error in page count value %i for user %s on printer %s"% (jobsize, kotafilter.printername, lastusername), "error")140 kotafilter.logger.log_message(_("Error in page count value %i for user %s on printer %s") % (jobsize, kotafilter.printername, lastusername), "error") 138 141 139 142 # pass the job untouched to the underlying layer -
pykota/trunk/bin/repykota
r770 r772 17 17 # 18 18 # $Log$ 19 # Revision 1.8 2003/02/09 12:56:53 jalet 20 # Internationalization begins... 21 # 19 22 # Revision 1.7 2003/02/08 23:17:20 jalet 20 23 # repykota now outputs life time page counters and the total pages printed by … … 102 105 printernames = self.storage.getMatchingPrinters(options["printer"]) 103 106 if not printernames : 104 raise PyKotaToolError, "There's no printer matching %s"% options["printer"]107 raise PyKotaToolError, _("There's no printer matching %s") % options["printer"] 105 108 for printer in printernames : 106 print "*** Report for %s quota on printer %s"% ((options["users"] and "user") or "group", printer)107 print "Pages grace time: %idays"% self.config.getGraceDelay()109 print _("*** Report for %s quota on printer %s") % ((options["users"] and "user") or "group", printer) 110 print _("Pages grace time: %idays") % self.config.getGraceDelay() 108 111 total = 0 109 112 if options["users"] : 110 print "User used soft hard grace total"113 print _("User used soft hard grace total") 111 114 print "------------------------------------------------------------" 112 115 for name in self.storage.getPrinterUsers(printer) : … … 114 117 total += self.printQuota(name, quota) 115 118 else : 116 print "Group used soft hard grace total"119 print _("Group used soft hard grace total") 117 120 print "------------------------------------------------------------" 118 121 for name in self.storage.getPrinterGroups(printer) : … … 171 174 reporter.display_version_and_quit() 172 175 elif options["users"] and options["groups"] : 173 raise PyKotaToolError, "repykota: options --users and --groups are incompatible."176 raise PyKotaToolError, _("repykota: options --users and --groups are incompatible.") 174 177 elif options["groups"] : 175 raise PyKotaToolError, "repykota: options --groups is currently not implemented."178 raise PyKotaToolError, _("repykota: options --groups is currently not implemented.") 176 179 elif args : 177 raise PyKotaToolError, "repykota: unused arguments [%s]. Aborting."% ", ".join(args)180 raise PyKotaToolError, _("repykota: unused arguments [%s]. Aborting.") % ", ".join(args) 178 181 else : 179 182 sys.exit(reporter.main(options)) -
pykota/trunk/bin/warnpykota
r751 r772 17 17 # 18 18 # $Log$ 19 # Revision 1.6 2003/02/09 12:56:53 jalet 20 # Internationalization begins... 21 # 19 22 # Revision 1.5 2003/02/07 23:24:38 jalet 20 23 # Empty line deleted … … 100 103 printernames = self.storage.getMatchingPrinters(options["printer"]) 101 104 if not printernames : 102 raise PyKotaToolError, "There's no printer matching %s"% options["printer"]105 raise PyKotaToolError, _("There's no printer matching %s") % options["printer"] 103 106 for printer in printernames : 104 107 if options["users"] : … … 137 140 sender.display_version_and_quit() 138 141 elif options["users"] and options["groups"] : 139 raise PyKotaToolError, "warnpykota: options --users and --groups are incompatible."142 raise PyKotaToolError, _("warnpykota: options --users and --groups are incompatible.") 140 143 elif options["groups"] : 141 raise PyKotaToolError, "warnpykota: options --groups is currently not implemented."144 raise PyKotaToolError, _("warnpykota: options --groups is currently not implemented.") 142 145 elif args : 143 raise PyKotaToolError, "warnpykota: unused arguments [%s]. Aborting."% ", ".join(args)146 raise PyKotaToolError, _("warnpykota: unused arguments [%s]. Aborting.") % ", ".join(args) 144 147 else : 145 148 sys.exit(sender.main(options)) -
pykota/trunk/pykota/tool.py
r764 r772 15 15 # 16 16 # $Log$ 17 # Revision 1.16 2003/02/09 12:56:53 jalet 18 # Internationalization begins... 19 # 17 20 # Revision 1.15 2003/02/08 22:09:52 jalet 18 21 # Name check method moved here … … 70 73 import getopt 71 74 import smtplib 75 import gettext 76 from locale import setlocale, LC_ALL 72 77 73 78 from mx import DateTime … … 88 93 def __init__(self, isfilter=0, doc="PyKota %s (c) 2003 %s" % (version.__version__, version.__author__)) : 89 94 """Initializes the command line tool.""" 95 # locale stuff 96 setlocale(LC_ALL, "") 97 gettext.install("pykota") 98 99 # pykota specific stuff 90 100 self.documentation = doc 91 101 self.config = config.PyKotaConfig(os.environ.get("CUPS_SERVERROOT", "/etc/cups"))