Changeset 1687 for pykota/trunk/pykota/accounters
- Timestamp:
- 09/01/04 01:29:53 (20 years ago)
- Location:
- pykota/trunk/pykota/accounters
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/accounters/hardware.py
r1685 r1687 22 22 # 23 23 # $Log$ 24 # Revision 1.11 2004/08/31 23:29:53 jalet 25 # Introduction of the new 'onaccountererror' configuration directive. 26 # Small fix for software accounter's return code which can't be None anymore. 27 # Make software and hardware accounting code look similar : will be factorized 28 # later. 29 # 24 30 # Revision 1.10 2004/08/27 22:49:04 jalet 25 31 # No answer from subprocess now is really a fatal error. Waiting for some … … 154 160 except OSError, msg : 155 161 self.filter.logdebug("Error while waiting for hardware accounter pid %s : %s" % (child.pid, msg)) 156 if (pagecounter is not None) and os.WIFEXITED(status) and (not os.WEXITSTATUS(status)) :157 return pagecounter158 162 else : 159 raise PyKotaAccounterError, _("Unable to query printer %s via HARDWARE(%s)") % (printer, commandline) 163 if os.WIFEXITED(status) : 164 status = os.WEXITSTATUS(status) 165 self.filter.printInfo(_("Hardware accounter %s exit code is %s") % (self.arguments, str(status))) 160 166 167 if pagecounter is None : 168 message = _("Unable to query printer %s via HARDWARE(%s)") % (printer, commandline) 169 if self.onerror == "CONTINUE" : 170 self.filter.printInfo(message, "error") 171 else : 172 raise PyKotaAccounterError, message 173 return pagecounter -
pykota/trunk/pykota/accounters/software.py
r1680 r1687 22 22 # 23 23 # $Log$ 24 # Revision 1.10 2004/08/31 23:29:53 jalet 25 # Introduction of the new 'onaccountererror' configuration directive. 26 # Small fix for software accounter's return code which can't be None anymore. 27 # Make software and hardware accounting code look similar : will be factorized 28 # later. 29 # 24 30 # Revision 1.9 2004/08/25 22:34:39 jalet 25 31 # Now both software and hardware accounting raise an exception when no valid … … 99 105 100 106 try : 101 retcode= child.wait()107 status = child.wait() 102 108 except OSError, msg : 103 109 self.filter.printInfo(_("Problem while waiting for software accounter pid %s to exit : %s") % (child.pid, msg)) 104 110 else : 105 if os.WIFEXITED(retcode) : 106 status = os.WEXITSTATUS(retcode) 107 else : 108 status = retcode 111 if os.WIFEXITED(status) : 112 status = os.WEXITSTATUS(status) 109 113 self.filter.printInfo(_("Software accounter %s exit code is %s") % (self.arguments, str(status))) 110 114 111 115 if pagecounter is None : 112 raise PyKotaAccounterError, _("Unable to compute job size with accounter %s") % self.arguments 116 message = _("Unable to compute job size with accounter %s") % self.arguments 117 if self.onerror == "CONTINUE" : 118 self.filter.printInfo(message, "error") 119 else : 120 raise PyKotaAccounterError, message 113 121 114 self.filter.logdebug("Software accounter %s said job is %s pages long." % (self.arguments, pagecounter)) 115 return pagecounter 116 122 self.filter.logdebug("Software accounter %s said job is %s pages long." % (self.arguments, repr(pagecounter))) 123 return pagecounter or 0