| 727 | self.exportJobInfo() |
| 728 | |
| 729 | def exportJobInfo(self) : |
| 730 | """Exports job information to the environment.""" |
| 731 | os.putenv("PYKOTAUSERNAME", self.username) |
| 732 | os.putenv("PYKOTAPRINTERNAME", self.printername) |
| 733 | os.putenv("PYKOTAJOBID", self.jobid) |
| 734 | os.putenv("PYKOTATITLE", self.title or "") |
| 735 | os.putenv("PYKOTAFILENAME", self.preserveinputfile or "") |
| 736 | os.putenv("PYKOTACOPIES", str(self.copies)) |
| 737 | os.putenv("PYKOTAOPTIONS", self.options or "") |
| 739 | def exportUserInfo(self, userpquota) : |
| 740 | """Exports user information to the environment.""" |
| 741 | os.putenv("PYKOTABALANCE", str(userpquota.User.AccountBalance or 0.0)) |
| 742 | os.putenv("PYKOTALIFETIMEPAID", str(userpquota.User.LifeTimePaid or 0.0)) |
| 743 | os.putenv("PYKOTAPAGECOUNTER", str(userpquota.PageCounter or 0)) |
| 744 | os.putenv("PYKOTALIFEPAGECOUNTER", str(userpquota.LifePageCounter or 0)) |
| 745 | os.putenv("PYKOTASOFTLIMIT", str(userpquota.SoftLimit)) |
| 746 | os.putenv("PYKOTAHARDLIMIT", str(userpquota.HardLimit)) |
| 747 | os.putenv("PYKOTADATELIMIT", str(userpquota.DateLimit)) |
| 748 | |
| 749 | def prehook(self, userpquota) : |
| 750 | """Allows pluging of an external hook before the job gets printed.""" |
| 751 | os.putenv("PYKOTAPHASE", "BEFORE") |
| 752 | prehook = self.config.getPreHook(userpquota.Printer.Name) |
| 753 | if prehook : |
| 754 | self.logdebug("Executing pre-hook [%s]" % prehook) |
| 755 | os.system(prehook) |
| 756 | |
| 757 | def posthook(self, userpquota) : |
| 758 | """Allows pluging of an external hook after the job gets printed and/or denied.""" |
| 759 | os.putenv("PYKOTAPHASE", "AFTER") |
| 760 | posthook = self.config.getPostHook(userpquota.Printer.Name) |
| 761 | if posthook : |
| 762 | self.logdebug("Executing post-hook [%s]" % posthook) |
| 763 | os.system(posthook) |
| 764 | |