| 207 | def getOverwriteJobTicket(self, printername) : |
| 208 | """Returns the overwrite_jobticket directive's content, or None if unset.""" |
| 209 | try : |
| 210 | return self.getPrinterOption(printername, "overwrite_jobticket").strip() |
| 211 | except PyKotaConfigError : |
| 212 | return # No overwriting will be done |
| 213 | |
| 214 | def getUnknownBillingCode(self, printername) : |
| 215 | """Returns the unknown_billingcode directive's content, or the default value if unset.""" |
| 216 | validvalues = [ "CREATE", "DENY" ] |
| 217 | try : |
| 218 | fullvalue = self.getPrinterOption(printername, "unknown_billingcode") |
| 219 | except PyKotaConfigError : |
| 220 | return ("CREATE", None) |
| 221 | else : |
| 222 | try : |
| 223 | value = [x.strip() for x in fullvalue.split('(', 1)] |
| 224 | except ValueError : |
| 225 | raise PyKotaConfigError, _("Invalid unknown_billingcode directive %s for printer %s") % (fullvalue, printername) |
| 226 | if len(value) == 1 : |
| 227 | value.append("") |
| 228 | (value, args) = value |
| 229 | if args.endswith(')') : |
| 230 | args = args[:-1] |
| 231 | value = value.upper() |
| 232 | if (value == "DENY") and not args : |
| 233 | return ("DENY", None) |
| 234 | if value not in validvalues : |
| 235 | raise PyKotaConfigError, _("Directive unknown_billingcode in section %s only supports values in %s") % (printername, str(validvalues)) |
| 236 | return (value, args) |
| 237 | |