Changeset 1041 for pykota/trunk/bin
- Timestamp:
- 06/25/03 16:10:01 (21 years ago)
- Location:
- pykota/trunk/bin
- Files:
-
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/edpykota
r1031 r1041 23 23 # 24 24 # $Log$ 25 # Revision 1.47 2003/06/25 14:10:01 jalet 26 # Hey, it may work (edpykota --reset excepted) ! 27 # 25 28 # Revision 1.46 2003/06/16 11:59:09 jalet 26 29 # More work on LDAP … … 330 333 def main(self, names, options) : 331 334 """Edit user or group quotas.""" 332 printeradded = 0 333 printers = self.storage.getMatchingPrinters(options["printer"]) 334 if not printers : 335 pname = options["printer"] 336 if options["add"] and pname : 337 if self.isValidName(pname) : 338 printerid = self.storage.addPrinter(pname) 339 printers = [ (printerid, pname) ] 340 printeradded = 1 341 else : 342 raise PyKotaToolError, _("Invalid printer name %s") % pname 343 else : 344 raise PyKotaToolError, _("There's no printer matching %s") % pname 345 335 336 suffix = (options["groups"] and "Group") or "User" 337 346 338 softlimit = hardlimit = None 347 if options["softlimit"] : 348 try : 349 softlimit = int(options["softlimit"].strip()) 350 except ValueError : 351 raise PyKotaToolError, _("Invalid softlimit value %s.") % options["softlimit"] 352 if options["hardlimit"] : 353 try : 354 hardlimit = int(options["hardlimit"].strip()) 355 except ValueError : 356 raise PyKotaToolError, _("Invalid hardlimit value %s.") % options["hardlimit"] 357 if (softlimit is not None) and (hardlimit is not None) and (hardlimit < softlimit) : 358 # error, exchange them 359 self.logger.log_message(_("Hard limit %i is less than soft limit %i, values will be exchanged.") % (hardlimit, softlimit)) 360 (softlimit, hardlimit) = (hardlimit, softlimit) 339 if not options["noquota"] : 340 if options["softlimit"] : 341 try : 342 softlimit = int(options["softlimit"].strip()) 343 except ValueError : 344 raise PyKotaToolError, _("Invalid softlimit value %s.") % options["softlimit"] 345 if options["hardlimit"] : 346 try : 347 hardlimit = int(options["hardlimit"].strip()) 348 except ValueError : 349 raise PyKotaToolError, _("Invalid hardlimit value %s.") % options["hardlimit"] 350 if (softlimit is not None) and (hardlimit is not None) and (hardlimit < softlimit) : 351 # error, exchange them 352 self.logger.log_message(_("Hard limit %i is less than soft limit %i, values will be exchanged.") % (hardlimit, softlimit)) 353 (softlimit, hardlimit) = (hardlimit, softlimit) 361 354 362 if not names :363 if options["add"] and not printeradded :364 raise PyKotaToolError, _("You have to pass user or group names on the command line")365 else :366 names = [ "*" ] # all users367 368 355 balance = options["balance"] 369 356 if balance : … … 394 381 groupnames = [] 395 382 396 uwaschanged = {} # tracks changed made at the user level 397 gwaschanged = {} # tracks changed made at the group level 398 for (printerid, printer) in printers : 383 if options["prototype"] : 384 protoentry = getattr(self.storage, "get%s" % suffix)(options["prototype"]) 385 386 printeradded = 0 387 printers = self.storage.getMatchingPrinters(options["printer"]) 388 if not printers : 389 pname = options["printer"] 390 if options["add"] and pname : 391 if self.isValidName(pname) : 392 printers = [ self.storage.addPrinter(pname) ] 393 if printers[0].Exists : 394 printeradded = 1 395 else : 396 raise PyKotaToolError, _("Impossible to add printer %s") % pname 397 else : 398 raise PyKotaToolError, _("Invalid printer name %s") % pname 399 else : 400 raise PyKotaToolError, _("There's no printer matching %s") % pname 401 if not names : 402 if options["add"] and not printeradded : 403 raise PyKotaToolError, _("You have to pass user or group names on the command line") 404 else : 405 names = [ "*" ] # all users 406 407 changed = {} # tracks changes made at the user/group level 408 for printer in printers : 399 409 if options["charge"] : 400 410 (perpage, perjob) = charges 401 if perjob is None : 402 # we don't want to change this one, get the old value 403 (dummy, perjob) = self.storage.getPrinterPrices(printerid) 404 self.storage.setPrinterPrices(printerid, perpage, perjob) 411 printer.setPrices(perpage, perjob) 412 405 413 if options["prototype"] : 406 if options["groups"] : 407 prototype = self.storage.getGroupPQuota(self.storage.getGroupId(options["prototype"]), printerid) 408 else : 409 # default is user quota edition 410 prototype = self.storage.getUserPQuota(self.storage.getUserId(options["prototype"]), printerid) 411 if prototype is None : 412 self.logger.log_message(_("Prototype %s not found in Quota Storage for printer %s.") % (options["prototype"], printer)) 413 continue # skip this printer 414 else : 415 (softlimit, hardlimit) = (prototype["softlimit"], prototype["hardlimit"]) 416 if hardlimit is None : 417 hardlimit = softlimit 418 if hardlimit is not None : 419 self.logger.log_message(_("Undefined hard limit set to soft limit (%s) on printer %s.") % (str(hardlimit), printer)) 420 if softlimit is None : 421 softlimit = hardlimit 422 if softlimit is not None : 423 self.logger.log_message(_("Undefined soft limit set to hard limit (%s) on printer %s.") % (str(softlimit), printer)) 424 if (not options["ingroups"] and not options["reset"] and not options["noquota"] and not options["prototype"] and not options["limitby"] and not options["balance"] and not options["delete"] and not options["charge"]) and ((hardlimit is None) or (softlimit is None)) : 425 raise PyKotaToolError, _("Both hard and soft limits must be set ! Aborting.") 414 if protoentry.Exists : 415 protoquota = getattr(self.storage, "get%PQuota" % suffix)(protoentry, printer) 416 if not protoquota.Exists : 417 self.logger.log_message(_("Prototype %s not found in Quota Storage for printer %s.") % (protoentry.Name, printer.Name)) 418 continue # skip this printer 419 else : 420 (softlimit, hardlimit) = (protoquota.SoftLimit, protoquota.HardLimit) 421 else : 422 self.logger.log_message(_("Prototype object %s not found in Quota Storage.") % protoentry.Name) 423 if not options["noquota"] : 424 if hardlimit is None : 425 hardlimit = softlimit 426 if hardlimit is not None : 427 self.logger.log_message(_("Undefined hard limit set to soft limit (%s) on printer %s.") % (str(hardlimit), printer.Name)) 428 if softlimit is None : 429 softlimit = hardlimit 430 if softlimit is not None : 431 self.logger.log_message(_("Undefined soft limit set to hard limit (%s) on printer %s.") % (str(softlimit), printer.Name)) 432 426 433 if options["add"] : 427 if options["groups"] : 428 allidnames = [(self.storage.getGroupId(n), n) for n in names] 429 else : 430 allidnames = [(self.storage.getUserId(n), n) for n in names] 434 allentries = [] 435 for name in names : 436 entry = getattr(self.storage, "get%s" % suffix)(name) 437 entrypquota = getattr(self.storage, "get%sPQuota" % suffix)(entry, printer) 438 allentries.append((entry, entrypquota)) 431 439 else : 432 if options["groups"] : 433 allidnames = self.storage.getPrinterGroups(printerid) or [] 434 else : 435 allidnames = self.storage.getPrinterUsers(printerid) or [] 436 for (ident, name) in [(i, n) for (i, n) in allidnames if self.matchString(n, names)]: 437 if options["groups"] : 438 if not gwaschanged.has_key(name) : 439 gwaschanged[name] = {} 440 quota = self.storage.getGroupPQuota(ident, printerid) 441 else : 442 if not uwaschanged.has_key(name) : 443 uwaschanged[name] = {"ingroups": []} 444 quota = self.storage.getUserPQuota(ident, printerid) 445 if quota is None : 440 allentries = getattr(self.storage, "getPrinter%ssAndQuotas" % suffix)(printer) 441 442 for (entry, entrypquota) in [(e, q) for (e, q) in allentries if self.matchString(e.Name, names)] : 443 if not changed.has_key(entry.Name) : 444 changed[entry.Name] = {} 445 if not entrypquota.Exists : 446 446 # not found 447 447 if options["add"] : … … 450 450 # like /etc/passwd because users may be defined 451 451 # only remotely 452 if options["groups"] : 453 if self.isValidName(name) : 454 (ident, printerid) = self.storage.addGroupPQuota(name, printerid) 455 quota = self.storage.getGroupPQuota(ident, printerid) 452 if self.isValidName(entry.Name) : 453 if not entry.Exists : 454 entry = getattr(self.storage, "add%s" % suffix)(entry) 455 entrypquota = getattr(self.storage, "add%sPQuota" % suffix)(entry, printer) 456 else : 457 if options["groups"] : 458 self.logger.log_message(_("Invalid group name %s") % entry.Name) 456 459 else : 457 self.logger.log_message(_("Invalid group name %s") % name) 458 else : 459 if self.isValidName(name) : 460 (ident, printerid) = self.storage.addUserPQuota(name, printerid) 461 quota = self.storage.getUserPQuota(ident, printerid) 462 else : 463 self.logger.log_message(_("Invalid user name %s") % name) 464 if quota is None : 465 self.logger.log_message(_("Quota not found for object %s on printer %s.") % (name, printer)) 460 self.logger.log_message(_("Invalid user name %s") % entry.Name) 461 if not entrypquota.Exists : 462 self.logger.log_message(_("Quota not found for object %s on printer %s.") % (entry.Name, printer.Name)) 466 463 else : 467 464 if options["delete"] : 468 if options["groups"] : 469 self.storage.deleteGroup(ident) 470 else : 471 self.storage.deleteUser(ident) 465 entry.delete() 472 466 else : 473 if options["groups"] : 474 if options["noquota"] or options["prototype"] or ((softlimit is not None) and (hardlimit is not None)) : 475 self.storage.setGroupPQuota(ident, printerid, softlimit, hardlimit) 467 if options["noquota"] or options["prototype"] or ((softlimit is not None) and (hardlimit is not None)) : 468 entrypquota.setLimits(softlimit, hardlimit) 469 if limitby : 470 if changed[entry.Name].get("limitby") is None : 471 entry.setLimitBy(limitby) 472 changed[entry.Name]["limitby"] = limitby 473 474 if not options["groups"] : 476 475 if options["reset"] : 477 self.storage.resetGroupPQuota(ident, printerid) 478 if limitby : 479 if gwaschanged[name].get("limitby") is None : 480 self.storage.limitGroupBy(ident, limitby) 481 gwaschanged[name]["limitby"] = limitby 482 self.warnGroupPQuota(name, printer) 483 else : 484 if options["noquota"] or options["prototype"] or ((softlimit is not None) and (hardlimit is not None)) : 485 self.storage.setUserPQuota(ident, printerid, softlimit, hardlimit) 486 if options["reset"] : 487 self.storage.resetUserPQuota(ident, printerid) 488 if limitby : 489 if uwaschanged[name].get("limitby") is None : 490 self.storage.limitUserBy(ident, limitby) 491 uwaschanged[name]["limitby"] = limitby 476 entrypquota.reset() 477 492 478 if balance : 493 if uwaschanged[name].get("balance") is None :479 if changed[entry.Name].get("balance") is None : 494 480 if balance.startswith("+") or balance.startswith("-") : 495 self.storage.increaseUserBalance(ident,balancevalue)481 entry.consumeAccountBalance(-balancevalue) 496 482 else : 497 self.storage.setUserBalance(ident,balancevalue)498 uwaschanged[name]["balance"] = balance483 entry.consumeAccountBalance(float(entry.AccountBalance or 0.0) - balancevalue) 484 changed[entry.Name]["balance"] = balance 499 485 for groupname in groupnames : 500 if groupname not in uwaschanged[name]["ingroups"] :501 group id = self.storage.getGroupId(groupname)502 if group id is not None:503 self.storage.addUserToGroup( ident, groupid)504 uwaschanged[name]["ingroups"].append(groupname)486 if groupname not in changed[name]["ingroups"] : 487 group = self.storage.getGroup(groupname) 488 if group.Exists : 489 self.storage.addUserToGroup(entry, group) 490 changed[entry.Name]["ingroups"].append(groupname) 505 491 else : 506 492 self.logger.log_message(_("Group %s not found in the PyKota Storage.") % groupname) 507 self.warnUserPQuota(name, printer) 493 494 getattr(self, "warn%sPQuota" % suffix)(entrypquota) 508 495 509 496 if __name__ == "__main__" : -
pykota/trunk/bin/pykota
r1026 r1041 23 23 # 24 24 # $Log$ 25 # Revision 1.35 2003/06/25 14:10:01 jalet 26 # Hey, it may work (edpykota --reset excepted) ! 27 # 25 28 # Revision 1.34 2003/06/13 18:54:17 jalet 26 29 # Bug with remote jobs and LPRng fixed. … … 239 242 240 243 # Get the last page counter and last username from the Quota Storage backend 241 printer id = kotafilter.storage.getPrinterId(kotafilter.printername)242 if printerid is None:244 printer = kotafilter.storage.getPrinter(kotafilter.printername) 245 if not printer.Exists : 243 246 # The printer is unknown from the Quota Storage perspective 244 247 # we let the job pass through, but log a warning message 245 248 kotafilter.logger.log_message(_("Printer %s not registered in the PyKota system") % kotafilter.printername, "warn") 246 249 else : 247 user id = kotafilter.storage.getUserId(kotafilter.username)248 if userid is None:250 user = kotafilter.storage.getUser(kotafilter.username) 251 if not user.Exists : 249 252 # The user is unknown from the Quota Storage perspective 250 253 # Depending on the default policy for this printer, we … … 261 264 else : 262 265 # Now does the accounting and act depending on the result 263 action = kotafilter.accounter.doAccounting(printer id, userid)266 action = kotafilter.accounter.doAccounting(printer, user) 264 267 265 268 # if not allowed to print then die, else proceed. -
pykota/trunk/bin/repykota
r1030 r1041 23 23 # 24 24 # $Log$ 25 # Revision 1.39 2003/06/25 14:10:01 jalet 26 # Hey, it may work (edpykota --reset excepted) ! 27 # 25 28 # Revision 1.38 2003/06/15 22:26:52 jalet 26 29 # More work on LDAP … … 147 150 148 151 import sys 152 import os 153 import pwd 154 import grp 149 155 150 156 from mx import DateTime … … 187 193 188 194 This will print the quota status for all users on all printers. 195 196 $ repykota --printer "laser*" jerome "jo*" 197 198 This will print the quota status for user jerome and all users 199 whose name begins with "jo" on all printers which name begin 200 with "laser" 201 202 If launched by a non-root user, additionnal arguments representing 203 users or groups names are ignored, and only the current user/group 204 is reported. 189 205 190 206 This program is free software; you can redistribute it and/or modify … … 206 222 class RePyKota(PyKotaTool) : 207 223 """A class for repykota.""" 208 def main(self, options) :224 def main(self, ugnames, options) : 209 225 """Print Quota reports generator.""" 226 uid = os.geteuid() 227 if not uid : 228 # root user 229 if not ugnames : 230 # no username, means all usernames 231 ugnames = [ "*" ] 232 else : 233 # not the root user 234 # reports only the current user 235 if options["groups"] : 236 ugnames = [ grp.getgrgid(pwd.getpwuid(uid)[3])[0] ] 237 else : 238 ugnames = [ pwd.getpwuid(uid)[0] ] 239 210 240 printers = self.storage.getMatchingPrinters(options["printer"]) 211 241 if not printers : 212 242 raise PyKotaToolError, _("There's no printer matching %s") % options["printer"] 213 for (printerid, printer) in printers : 214 print _("*** Report for %s quota on printer %s") % ((options["groups"] and "group") or "user", printer) 215 print _("Pages grace time: %i days") % self.config.getGraceDelay(printer) 216 prices = self.storage.getPrinterPrices(printerid) 217 if prices is None : 218 (perpage, perjob) = (None, None) 219 else : 220 (perpage, perjob) = prices 221 if perjob is not None : 222 print _("Price per job: %.3f") % perjob 223 if perpage is not None : 224 print _("Price per page: %.3f") % perpage 243 for printer in printers : 244 print _("*** Report for %s quota on printer %s") % ((options["groups"] and "group") or "user", printer.Name) 245 print _("Pages grace time: %i days") % self.config.getGraceDelay(printer.Name) 246 if printer.PricePerJob is not None : 247 print _("Price per job: %.3f") % printer.PricePerJob 248 if printer.PricePerPage is not None : 249 print _("Price per page: %.3f") % printer.PricePerPage 225 250 total = 0 226 251 totalmoney = 0.0 … … 228 253 print _("Group used soft hard balance grace total paid") 229 254 print "------------------------------------------------------------------------------" 230 for (ident, name) in (self.storage.getPrinterGroups(printerid) or []) : 231 quota = self.storage.getGroupPQuota(ident, printerid) 232 balance = self.storage.getGroupBalance(ident) 233 limitby = self.storage.getGroupLimitBy(ident) 234 (pages, money) = self.printQuota(name, quota, balance, limitby) 255 for (group, grouppquota) in self.storage.getPrinterGroupsAndQuotas(printer, ugnames) : 256 (pages, money) = self.printQuota(group, grouppquota) 235 257 total += pages 236 258 totalmoney += money … … 239 261 print _("User used soft hard balance grace total paid") 240 262 print "------------------------------------------------------------------------------" 241 for (ident, name) in (self.storage.getPrinterUsers(printerid) or []) : 242 quota = self.storage.getUserPQuota(ident, printerid) 243 balance = self.storage.getUserBalance(ident) 244 limitby = self.storage.getUserLimitBy(ident) 245 (pages, money) = self.printQuota(name, quota, balance, limitby) 263 for (user, userpquota) in self.storage.getPrinterUsersAndQuotas(printer, ugnames) : 264 (pages, money) = self.printQuota(user, userpquota) 246 265 total += pages 247 266 totalmoney += money 248 267 if total or totalmoney : 249 268 print (" " * 50) + (_("Total : %9i") % total) + ("%11s" % ("%7.2f" % totalmoney)[:11]) 250 printerpagecounter = self.storage.getPrinterPageCounter(printerid)251 269 try : 252 msg = "%9i" % printer pagecounter["pagecounter"]270 msg = "%9i" % printer.LastJob.PrinterPageCounter 253 271 except TypeError : 254 272 msg = _("unknown") … … 258 276 print _("Totals may be inaccurate if some users are members of several groups.") 259 277 260 def printQuota(self, name, quota, balance, limitby) :278 def printQuota(self, entry, quota) : 261 279 """Prints the quota information.""" 262 if quota is not None : 263 lifepagecounter = quota["lifepagecounter"] or 0 264 pagecounter = quota["pagecounter"] or 0 265 softlimit = quota["softlimit"] 266 hardlimit = quota["hardlimit"] 267 datelimit = quota["datelimit"] 268 if balance is not None : 269 (balance, lifetimepaid) = balance 270 else : 271 (balance, lifetimepaid) = (0.0, 0.0) 272 if datelimit is not None : 273 now = DateTime.now() 274 datelimit = DateTime.ISO.ParseDateTime(datelimit) 275 if now >= datelimit : 276 datelimit = "DENY" 277 else : 278 datelimit = "" 279 if limitby == "balance" : 280 reached = (((balance <= 0) and "+") or "-") + "B" 281 else : 282 reached = (((softlimit is not None) and (pagecounter >= softlimit) and "+") or "-") + "Q" 283 balance = balance or 0.0 284 lifetimepaid = lifetimepaid or 0.0 285 strbalance = ("%5.2f" % balance)[:10] 286 strlifetimepaid = ("%6.2f" % lifetimepaid)[:10] 287 print "%-9.9s %s %7i %7s %7s %10s %-10.10s %8i %10s" % (name, reached, pagecounter, str(softlimit), str(hardlimit), strbalance, str(datelimit)[:10], lifepagecounter, strlifetimepaid) 288 return (lifepagecounter, lifetimepaid) 280 lifepagecounter = int(quota.LifePageCounter or 0) 281 pagecounter = int(quota.PageCounter or 0) 282 balance = float(entry.AccountBalance or 0.0) 283 lifetimepaid = float(entry.LifeTimePaid or 0.0) 284 285 if quota.DateLimit is not None : 286 now = DateTime.now() 287 datelimit = DateTime.ISO.ParseDateTime(quota.DateLimit) 288 if now >= datelimit : 289 datelimit = "DENY" 290 elif (quota.HardLimit is not None) and (pagecounter >= quota.HardLimit) : 291 datelimit = "DENY" 292 elif (quota.HardLimit is None) and (quota.SoftLimit is not None) and (pagecounter >= quota.SoftLimit) : 293 datelimit = "DENY" 289 294 else : 290 return (0, 0) 291 295 datelimit = "" 296 297 if entry.LimitBy.lower() == "balance" : 298 reached = (((balance <= 0) and "+") or "-") + "B" 299 else : 300 reached = (((quota.SoftLimit is not None) and (pagecounter >= quota.SoftLimit) and "+") or "-") + "Q" 301 302 strbalance = ("%5.2f" % balance)[:10] 303 strlifetimepaid = ("%6.2f" % lifetimepaid)[:10] 304 print "%-9.9s %s %7i %7s %7s %10s %-10.10s %8i %10s" % (entry.Name, reached, pagecounter, str(quota.SoftLimit), str(quota.HardLimit), strbalance, str(datelimit)[:10], lifepagecounter, strlifetimepaid) 305 return (lifepagecounter, lifetimepaid) 292 306 293 307 if __name__ == "__main__" : … … 318 332 elif options["users"] and options["groups"] : 319 333 raise PyKotaToolError, _("incompatible options, see help.") 320 elif args :321 raise PyKotaToolError, _("unused arguments [%s]. Aborting.") % ", ".join(args)322 334 else : 323 sys.exit(reporter.main( options))335 sys.exit(reporter.main(args, options)) 324 336 except (PyKotaToolError, PyKotaConfigError, PyKotaStorageError), msg : 325 337 sys.stderr.write("%s\n" % msg) -
pykota/trunk/bin/warnpykota
r975 r1041 23 23 # 24 24 # $Log$ 25 # Revision 1.20 2003/06/25 14:10:01 jalet 26 # Hey, it may work (edpykota --reset excepted) ! 27 # 25 28 # Revision 1.19 2003/04/29 22:03:38 jalet 26 29 # Better error handling. … … 84 87 85 88 import sys 89 import os 90 import pwd 91 import grp 86 92 87 93 from pykota import version … … 96 102 command line usage : 97 103 98 warnpykota [options]104 warnpykota [options] [names] 99 105 100 106 options : … … 125 131 any printer. 126 132 127 $ warnpykota --groups --printer "laserjet*" 128 129 This will warn all users of groups which have exceeded 130 their print quota on any printer which name begins with "laserjet" 133 $ warnpykota --groups --printer "laserjet*" "dev*" 134 135 This will warn all users of groups which names begins with "dev" and 136 who have exceeded their print quota on any printer which name begins 137 with "laserjet" 138 139 If launched by a non-root user, additionnal arguments representing 140 users or groups names are ignored, and only the current user/group 141 is warned. 131 142 132 143 This program is free software; you can redistribute it and/or modify … … 148 159 class WarnPyKota(PyKotaTool) : 149 160 """A class for warnpykota.""" 150 def main(self, options) :161 def main(self, ugnames, options) : 151 162 """Warn users or groups over print quota.""" 163 uid = os.geteuid() 164 if not uid : 165 # root user 166 if not ugnames : 167 # no username, means all usernames 168 ugnames = [ "*" ] 169 else : 170 # not the root user 171 # warns only the current user 172 # the utility of this is discutable, but at least it 173 # protects other users from mail bombing if they are 174 # over quota. 175 if options["groups"] : 176 ugnames = [ grp.getgrgid(pwd.getpwuid(uid)[3])[0] ] 177 else : 178 ugnames = [ pwd.getpwuid(uid)[0] ] 179 152 180 printers = self.storage.getMatchingPrinters(options["printer"]) 153 181 if not printers : 154 182 raise PyKotaToolError, _("There's no printer matching %s") % options["printer"] 155 for (printerid, printer)in printers :183 for printer in printers : 156 184 if options["groups"] : 157 for ( ident, name) in self.storage.getPrinterGroups(printerid) :158 self.warnGroupPQuota( name, printer)185 for (group, grouppquota) in self.storage.getPrinterGroupsAndQuotas(printer, ugnames) : 186 self.warnGroupPQuota(grouppquota) 159 187 else : 160 for ( ident, name) in self.storage.getPrinterUsers(printerid) :161 self.warnUserPQuota( name, printer)188 for (user, userpquota) in self.storage.getPrinterUsersAndQuotas(printer, ugnames) : 189 self.warnUserPQuota(userpquota) 162 190 163 191 if __name__ == "__main__" : … … 188 216 elif options["users"] and options["groups"] : 189 217 raise PyKotaToolError, _("incompatible options, see help.") 190 elif args :191 raise PyKotaToolError, _("unused arguments [%s]. Aborting.") % ", ".join(args)192 218 else : 193 sys.exit(sender.main( options))219 sys.exit(sender.main(args, options)) 194 220 except (PyKotaToolError, PyKotaConfigError, PyKotaStorageError), msg : 195 221 sys.stderr.write("%s\n" % msg)