Changeset 2631 for pykota/trunk/bin/cupspykota
- Timestamp:
- 01/26/06 16:25:44 (18 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/cupspykota
r2624 r2631 296 296 self.logdebug("Seen DENY command.") 297 297 action = "DENY" 298 elif line == "CANCEL" : 299 self.logdebug("Seen CANCEL command.") 300 action = "CANCEL" 298 301 elif line.startswith("USERNAME=") : 299 302 username = line.split("=", 1)[1].strip() … … 307 310 308 311 # now overwrite the job's ticket if new data was supplied 309 if action :312 if action == "DENY" : 310 313 self.Action = action 311 314 self.Reason = _("You are not allowed to print at this time.") 315 elif action == "CANCEL" : 316 self.Action = action 317 self.Reason = _("Print job cancelled.") 312 318 if username : 313 319 self.UserName = username … … 891 897 self.exportPhaseInfo("BEFORE") 892 898 893 if self.Action != "DENY":899 if self.Action not in ("DENY", "CANCEL") : 894 900 if self.Printer.MaxJobSize and (self.softwareJobSize > self.Printer.MaxJobSize) : 895 901 # This printer was set to refuse jobs this large. … … 900 906 self.Reason = _("You are not allowed to print so many pages on printer %s at this time.") % self.PrinterName 901 907 902 if self.Action != "DENY":908 if self.Action not in ("DENY", "CANCEL") : 903 909 if self.User.LimitBy == "noprint" : 904 910 self.printInfo(_("User %s is not allowed to print at this time.") % self.UserName, "warn") … … 906 912 self.Reason = _("Your account settings forbid you to print at this time.") 907 913 908 if self.Action != "DENY":914 if self.Action not in ("DENY", "CANCEL") : 909 915 # If printing is still allowed at this time, we 910 916 # need to extract the billing code information from the database. … … 913 919 self.getBillingCode() 914 920 915 if self.Action != "DENY":921 if self.Action not in ("DENY", "CANCEL") : 916 922 # If printing is still allowed at this time, we 917 923 # need to check if the job is a dupe or not, and what to do then. … … 920 926 self.checkIfDupe() 921 927 922 if self.Action != "DENY":928 if self.Action not in ("DENY", "CANCEL") : 923 929 # If printing is still allowed at this time, we 924 930 # need to check the user's print quota on the current printer. … … 962 968 if self.Action == "DENY" : 963 969 self.printInfo(_("Job denied, no accounting will be done.")) 970 elif self.Action == "CANCEL" : 971 self.printInfo(_("Job cancelled, no accounting will be done.")) 964 972 else : 965 973 self.printInfo(_("Job accounting begins.")) … … 990 998 if self.Action == "DENY" : 991 999 self.printInfo(_("Job denied, no accounting has been done.")) 1000 elif self.Action == "CANCEL" : 1001 self.printInfo(_("Job cancelled, no accounting has been done.")) 992 1002 else : 993 1003 self.deinstallSigTermHandler() … … 1020 1030 self.JobSize = 0 1021 1031 self.printInfo(_("Job size forced to 0 because printing is denied.")) 1032 elif self.Action == "CANCEL" : 1033 self.JobSize = 0 1034 self.printInfo(_("Job size forced to 0 because printing was cancelled.")) 1022 1035 else : 1023 1036 self.UserPQuota.resetDenyBannerCounter() … … 1028 1041 self.printInfo(_("Job size : %i") % self.JobSize) 1029 1042 1030 if (self.Action == "PROBLEM") and (onbackenderror == "NOCHARGE") : 1043 if ((self.Action == "PROBLEM") and (onbackenderror == "NOCHARGE")) or \ 1044 (self.Action in ("DENY", "CANCEL")) : 1031 1045 self.JobPrice = 0.0 1032 1046 elif (self.User.LimitBy == "nochange") or self.Printer.PassThrough : … … 1048 1062 1049 1063 if hasattr(self, "BillingCode") and self.BillingCode and self.BillingCode.Exists : 1050 if (self.Action != "PROBLEM") or (onbackenderror == "CHARGE") : 1064 if (self.Action in ("ALLOW", "WARN")) or \ 1065 ((self.Action == "PROBLEM") and (onbackenderror == "CHARGE")) : 1051 1066 self.BillingCode.consume(self.JobSize, self.JobPrice) 1052 1067 self.printInfo(_("Billing code %s was updated.") % self.BillingCode.BillingCode)