Changeset 2584
- Timestamp:
- 11/15/05 22:47:29 (19 years ago)
- Location:
- pykota/trunk
- Files:
-
- 8 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/cupspykota
r2580 r2584 988 988 self.storage.beginTransaction() 989 989 try : 990 onbackenderror = self.config.getPrinterOnBackendError(self.PrinterName) 991 if retcode : 992 # NB : We don't send any feedback to the end user. Only the admin 993 # has to know that the real CUPS backend failed. 994 self.Action = "PROBLEM" 995 self.exportReason() 996 if onbackenderror == "NOCHARGE" : 997 self.JobSize = 0 998 self.printInfo(_("Job size forced to 0 because the real CUPS backend failed. No accounting will be done."), "warn") 999 else : 1000 self.printInfo(_("The real CUPS backend failed, but the job will be accounted for anyway."), "warn") 1001 990 1002 # retrieve the job size 991 1003 if self.Action == "DENY" : … … 994 1006 else : 995 1007 self.UserPQuota.resetDenyBannerCounter() 996 self.JobSize = self.accounter.getJobSize(self.Printer) 997 self.sanitizeJobSize() 998 self.JobSize += self.BannerSize 1008 if (self.Action != "PROBLEM") or (onbackenderror == "CHARGE") : 1009 self.JobSize = self.accounter.getJobSize(self.Printer) 1010 self.sanitizeJobSize() 1011 self.JobSize += self.BannerSize 999 1012 self.printInfo(_("Job size : %i") % self.JobSize) 1000 1013 1001 if (self.User.LimitBy == "nochange") or self.Printer.PassThrough : 1014 if (self.Action == "PROBLEM") and (onbackenderror == "NOCHARGE") : 1015 self.JobPrice = 0.0 1016 elif (self.User.LimitBy == "nochange") or self.Printer.PassThrough : 1002 1017 # no need to update the quota for the current user on this printer 1003 1018 self.printInfo(_("User %s's quota on printer %s won't be modified") % (self.UserName, self.PrinterName)) … … 1017 1032 1018 1033 if hasattr(self, "BillingCode") and self.BillingCode and self.BillingCode.Exists : 1019 self.BillingCode.consume(self.JobSize, self.JobPrice) 1020 self.printInfo(_("Billing code %s was updated.") % self.BillingCode.BillingCode) 1034 if (self.Action != "PROBLEM") or (onbackenderror == "CHARGE") : 1035 self.BillingCode.consume(self.JobSize, self.JobPrice) 1036 self.printInfo(_("Billing code %s was updated.") % self.BillingCode.BillingCode) 1021 1037 except : 1022 1038 self.storage.rollbackTransaction() … … 1064 1080 arguments[2] = self.UserName # in case it was overwritten by external script 1065 1081 # TODO : do something about job-billing option, in case it was overwritten as well... 1082 # TODO : do something about the job title : if we are printing a banner and the backend 1083 # TODO : uses the job's title to name an output file (cups-pdf:// for example), we're stuck ! 1066 1084 1067 1085 self.logdebug("Starting original backend %s with args %s" % (originalbackend, " ".join(['"%s"' % a for a in arguments]))) … … 1095 1113 if os.WIFEXITED(status) : 1096 1114 status = os.WEXITSTATUS(status) 1115 message = "CUPS backend %s returned %d." % \ 1116 (originalbackend, status) 1097 1117 if status : 1098 1118 level = "error" 1119 self.Reason = message 1099 1120 else : 1100 1121 level = "info" 1101 self.printInfo("CUPS backend %s returned %d." % \ 1102 (originalbackend, status), level) 1122 self.printInfo(message, level) 1103 1123 return status 1104 1124 elif not killed : 1105 self. printInfo("CUPS backend %s died abnormally." % \1106 originalbackend, "error")1125 self.Reason = "CUPS backend %s died abnormally." % originalbackend 1126 self.printInfo(self.Reason, "error") 1107 1127 return -1 1108 1128 else : 1109 self. printInfo("CUPS backend %s was killed." % \1110 originalbackend, "warn")1129 self.Reason = "CUPS backend %s was killed." % originalbackend 1130 self.printInfo(self.Reason, "warn") 1111 1131 return 1 1112 1132 -
pykota/trunk/bin/waitprinter.sh
r2146 r2584 75 75 ##log_msg "`ls -la /var/spool/{cups,samba}`" 76 76 log_msg "Pykota Phase: ${PYKOTAPHASE}" 77 if [ x$PYKOTASTATUS != "xCANCELLED" ] && [ x$PYKOTAACTION != "xDENY" ] && [ x$PYKOTAPHASE = "xAFTER" ] ; then77 if [ x$PYKOTASTATUS != "xCANCELLED" ] && [ x$PYKOTAACTION = "xALLOW" ] && [ x$PYKOTAPHASE = "xAFTER" ] ; then 78 78 printing_wait "${printer}" 79 79 fi -
pykota/trunk/cgi-bin/printquota.cgi
r2578 r2584 228 228 elif job.JobAction == "WARN" : 229 229 oddevenclass = "warn" 230 elif job.JobAction == "PROBLEM" : 231 oddevenclass = "problem" 230 232 username_url = '<a href="%s?%s">%s</a>' % (os.environ.get("SCRIPT_NAME", ""), urllib.urlencode({"history" : 1, "username" : job.UserName}), job.UserName) 231 233 printername_url = '<a href="%s?%s">%s</a>' % (os.environ.get("SCRIPT_NAME", ""), urllib.urlencode({"history" : 1, "printername" : job.PrinterName}), job.PrinterName) -
pykota/trunk/NEWS
r2581 r2584 22 22 PyKota NEWS : 23 23 24 - 1.24alpha2 : 25 26 - Introduce the "onbackenderror" directive in pykota.conf, to 27 control if the user must be charged or not whenever a real 28 CUPS backend fails. The default value is 'nocharge'. 29 Set it to 'charge' if you think your users can cause a CUPS 30 backend to fail. 31 32 - Now mark original backends related problems as such in the 33 printing history. Modified printquota.cgi and pykota.css 34 to make them be more visible. 35 24 36 - 1.24alpha1 : 25 37 -
pykota/trunk/pykota/accounters/pjl.py
r2523 r2584 173 173 try : 174 174 if (os.environ.get("PYKOTASTATUS") != "CANCELLED") and \ 175 (os.environ.get("PYKOTAACTION") != "DENY") and \175 (os.environ.get("PYKOTAACTION") == "ALLOW") and \ 176 176 (os.environ.get("PYKOTAPHASE") == "AFTER") and \ 177 177 self.parent.filter.JobSizeBytes : -
pykota/trunk/pykota/accounters/snmp.py
r2506 r2584 175 175 try : 176 176 if (os.environ.get("PYKOTASTATUS") != "CANCELLED") and \ 177 (os.environ.get("PYKOTAACTION") != "DENY") and \177 (os.environ.get("PYKOTAACTION") == "ALLOW") and \ 178 178 (os.environ.get("PYKOTAPHASE") == "AFTER") and \ 179 179 self.parent.filter.JobSizeBytes : -
pykota/trunk/pykota/version.py
r2564 r2584 22 22 # 23 23 24 __version__ = "1.24alpha 1_unofficial"24 __version__ = "1.24alpha2_unofficial" 25 25 26 26 __doc__ = "PyKota : a complete Printing Quota Solution for CUPS." -
pykota/trunk/stylesheets/pykota.css
r2478 r2584 40 40 } 41 41 42 .problem { 43 background-color: #DEBDEB; 44 } 45 42 46 .pykotacolsheader { 43 47 background-color: #AAAAAA;