Changeset 2465 for pykota/trunk/bin/pkprinters
- Timestamp:
- 09/19/05 18:59:00 (19 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/pkprinters
r2463 r2465 80 80 -s | --skipexisting In combination with the --add option above, tells 81 81 pkprinters to not modify existing printers. 82 83 -m | --maxjobsize s Sets the maximum job size allowed on the printer 84 to s pages. 85 86 -p | --passthrough Activate passthrough mode for the printer. In this 87 mode, users are allowed to print without any impact 88 on their quota or account balance. 89 90 -n | --nopassthrough Deactivate passthrough mode for the printer. 91 Without -p or -n, printers are created in 92 normal mode, i.e. no passthrough. 82 93 83 94 printer1 through printerN can contain wildcards if the --add option … … 137 148 charges = [charges[0], None] 138 149 (perpage, perjob) = charges 150 151 if options["maxjobsize"] : 152 try : 153 maxjobsize = int(options["maxjobsize"]) 154 if maxjobsize < 0 : 155 raise ValueError 156 except ValueError : 157 raise PyKotaToolError, _("Invalid maximum job size value %s") % options["maxjobsize"] 158 else : 159 maxjobsize = None 160 139 161 140 162 if options["add"] : … … 181 203 if options["description"] is not None : 182 204 printer.setDescription(options["description"].strip()) 205 if options["nopassthrough"] and printer.PassThrough : 206 self.storage.setPrinterPassThroughMode(printer, 0) 207 if options["passthrough"] and not printer.PassThrough : 208 self.storage.setPrinterPassThroughMode(printer, 1) 209 if (maxjobsize is not None) and (printer.MaxJobSize != maxjobsize) : 210 self.storage.setPrinterMaxJobSize(printer, maxjobsize) 183 211 if options["groups"] : 184 212 for pgroup in printersgroups : … … 191 219 retcode = 0 192 220 try : 193 short_options = "hvac:D:dg:lrs" 194 long_options = ["help", "version", "add", "charge=", "description=", "delete", "groups=", "list", "remove", "skipexisting"] 221 short_options = "hvac:D:dg:lrsnpm:" 222 long_options = ["help", "version", "add", "charge=", "description=", \ 223 "delete", "groups=", "list", "remove", \ 224 "skipexisting", "passthrough", "nopassthrough", \ 225 "maxjobsize="] 195 226 196 227 # Initializes the command line tool … … 212 243 options["remove"] = options["r"] or options["remove"] 213 244 options["skipexisting"] = options["s"] or options["skipexisting"] 245 options["maxjobsize"] = options["m"] or options["maxjobsize"] 246 options["passthrough"] = options["p"] or options["passthrough"] 247 options["nopassthrough"] = options["n"] or options["nopassthrough"] 214 248 215 249 if options["help"] : … … 219 253 elif (options["delete"] and (options["add"] or options["groups"] or options["charge"] or options["remove"] or options["description"])) \ 220 254 or (options["skipexisting"] and not options["add"]) \ 221 or (options["list"] and (options["add"] or options["delete"] or options["groups"] or options["charge"] or options["remove"] or options["description"])) : 255 or (options["list"] and (options["add"] or options["delete"] or options["groups"] or options["charge"] or options["remove"] or options["description"])) \ 256 or (options["passthrough"] and options["nopassthrough"]) : 222 257 raise PyKotaToolError, _("incompatible options, see help.") 223 258 elif options["remove"] and not options["groups"] :