478 | | if self.tool.matchString(pname, pnames) and self.tool.matchString(uname, unames) : |
479 | | printer = StoragePrinter(self, pname) |
480 | | printer.ident = record.get("pid") |
481 | | printer.PricePerJob = record.get("priceperjob") or 0.0 |
482 | | printer.PricePerPage = record.get("priceperpage") or 0.0 |
483 | | printer.Description = self.databaseToUserCharset(record.get("pdesc") or "") |
484 | | printer.MaxJobSize = record.get("pmaxjobsize") or 0 |
485 | | printer.PassThrough = record.get("passthrough") or 0 |
486 | | if printer.PassThrough in (1, "1", "t", "true", "TRUE", "True") : |
487 | | printer.PassThrough = 1 |
488 | | else : |
489 | | printer.PassThrough = 0 |
490 | | printer.Exists = 1 |
491 | | printers[pname] = printer |
492 | | self.cacheEntry("PRINTERS", pname, printer) |
493 | | |
494 | | user = StorageUser(self, uname) |
495 | | user.ident = record.get("uid") |
496 | | user.LimitBy = record.get("limitby") or "quota" |
497 | | user.AccountBalance = record.get("balance") |
498 | | user.LifeTimePaid = record.get("lifetimepaid") |
499 | | user.Email = record.get("email") |
500 | | user.OverCharge = record.get("overcharge") |
501 | | user.Description = self.databaseToUserCharset(record.get("udesc")) |
502 | | user.Exists = 1 |
503 | | users[uname] = user |
504 | | self.cacheEntry("USERS", uname, user) |
505 | | |
506 | | upqkey = "%s@%s" % (uname, pname) |
507 | | userpquota = StorageUserPQuota(self, user, printer) |
508 | | userpquota.ident = record.get("id") |
509 | | userpquota.PageCounter = record.get("pagecounter") |
510 | | userpquota.LifePageCounter = record.get("lifepagecounter") |
511 | | userpquota.SoftLimit = record.get("softlimit") |
512 | | userpquota.HardLimit = record.get("hardlimit") |
513 | | userpquota.DateLimit = record.get("datelimit") |
514 | | userpquota.WarnCount = record.get("warncount") |
515 | | userpquota.Exists = 1 |
516 | | upquotas[upqkey] = userpquota |
517 | | self.cacheEntry("USERPQUOTAS", upqkey, userpquota) |
| 476 | if not matchpnames.has_key(pname) : |
| 477 | matchpnames[pname] = printermatches = self.tool.matchString(pname, pnames) |
| 478 | else : |
| 479 | printermatches = matchpnames[pname] |
| 480 | if printermatches : |
| 481 | if not matchunames.has_key(uname) : |
| 482 | matchunames[uname] = usermatches = self.tool.matchString(uname, unames) |
| 483 | else : |
| 484 | usermatches = matchunames[uname] |
| 485 | if usermatches : |
| 486 | printer = StoragePrinter(self, pname) |
| 487 | printer.ident = record.get("pid") |
| 488 | printer.PricePerJob = record.get("priceperjob") or 0.0 |
| 489 | printer.PricePerPage = record.get("priceperpage") or 0.0 |
| 490 | printer.Description = self.databaseToUserCharset(record.get("pdesc") or "") |
| 491 | printer.MaxJobSize = record.get("pmaxjobsize") or 0 |
| 492 | printer.PassThrough = record.get("passthrough") or 0 |
| 493 | if printer.PassThrough in (1, "1", "t", "true", "TRUE", "True") : |
| 494 | printer.PassThrough = 1 |
| 495 | else : |
| 496 | printer.PassThrough = 0 |
| 497 | printer.Exists = 1 |
| 498 | printers[pname] = printer |
| 499 | self.cacheEntry("PRINTERS", pname, printer) |
| 500 | |
| 501 | user = StorageUser(self, uname) |
| 502 | user.ident = record.get("uid") |
| 503 | user.LimitBy = record.get("limitby") or "quota" |
| 504 | user.AccountBalance = record.get("balance") |
| 505 | user.LifeTimePaid = record.get("lifetimepaid") |
| 506 | user.Email = record.get("email") |
| 507 | user.OverCharge = record.get("overcharge") |
| 508 | user.Description = self.databaseToUserCharset(record.get("udesc")) |
| 509 | user.Exists = 1 |
| 510 | users[uname] = user |
| 511 | self.cacheEntry("USERS", uname, user) |
| 512 | |
| 513 | upqkey = "%s@%s" % (uname, pname) |
| 514 | userpquota = StorageUserPQuota(self, user, printer) |
| 515 | userpquota.ident = record.get("id") |
| 516 | userpquota.PageCounter = record.get("pagecounter") |
| 517 | userpquota.LifePageCounter = record.get("lifepagecounter") |
| 518 | userpquota.SoftLimit = record.get("softlimit") |
| 519 | userpquota.HardLimit = record.get("hardlimit") |
| 520 | userpquota.DateLimit = record.get("datelimit") |
| 521 | userpquota.WarnCount = record.get("warncount") |
| 522 | userpquota.Exists = 1 |
| 523 | upquotas[upqkey] = userpquota |
| 524 | self.cacheEntry("USERPQUOTAS", upqkey, userpquota) |
530 | | if self.tool.matchString(pname, pnames) and self.tool.matchString(gname, gnames) : |
531 | | printer = self.getPrinter(pname) |
532 | | printers[pname] = printer |
533 | | group = self.getGroup(gname) |
534 | | groups[gname] = group |
535 | | gpqkey = "%s@%s" % (gname, pname) |
536 | | gpquotas[upqkey] = self.getGroupPQuota(group, printer) |
| 539 | if not matchpnames.has_key(pname) : |
| 540 | matchpnames[pname] = printermatches = self.tool.matchString(pname, pnames) |
| 541 | else : |
| 542 | printermatches = matchpnames[pname] |
| 543 | if printermatches : |
| 544 | if not matchgnames.has_key(gname) : |
| 545 | matchgnames[gname] = groupmatches = self.tool.matchString(gname, gnames) |
| 546 | else : |
| 547 | groupmatches = matchgnames[gname] |
| 548 | if groupmatches : |
| 549 | printer = self.getPrinter(pname) |
| 550 | printers[pname] = printer |
| 551 | group = self.getGroup(gname) |
| 552 | groups[gname] = group |
| 553 | gpqkey = "%s@%s" % (gname, pname) |
| 554 | gpquotas[upqkey] = self.getGroupPQuota(group, printer) |