| 636 | |
| 637 | def getTrustJobSize(self, printername) : |
| 638 | """Returns the normalized value of the trustjobsize's directive.""" |
| 639 | try : |
| 640 | value = self.getPrinterOption(printername, "trustjobsize").strip().upper() |
| 641 | except PyKotaConfigError : |
| 642 | return (None, "YES") |
| 643 | else : |
| 644 | if value == "YES" : |
| 645 | return (None, "YES") |
| 646 | try : |
| 647 | (limit, replacement) = [p.strip() for p in value.split(">")[1].split(":")] |
| 648 | limit = int(limit) |
| 649 | try : |
| 650 | replacement = int(replacement) |
| 651 | except ValueError : |
| 652 | if replacement != "PRECOMPUTED" : |
| 653 | raise |
| 654 | if limit < 0 : |
| 655 | raise ValueError |
| 656 | if (replacement != "PRECOMPUTED") and (replacement < 0) : |
| 657 | raise ValueError |
| 658 | except (IndexError, ValueError, TypeError) : |
| 659 | raise PyKotaConfigError, _("Option trustjobsize for printer %s is incorrect") % printername |
| 660 | return (limit, replacement) |