Show
Ignore:
Timestamp:
09/01/04 01:29:53 (20 years ago)
Author:
jalet
Message:

Introduction of the new 'onaccountererror' configuration directive.
Small fix for software accounter's return code which can't be None anymore.
Make software and hardware accounting code look similar : will be factorized
later.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/accounters/hardware.py

    r1685 r1687  
    2222# 
    2323# $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# 
    2430# Revision 1.10  2004/08/27 22:49:04  jalet 
    2531# No answer from subprocess now is really a fatal error. Waiting for some 
     
    154160        except OSError, msg :     
    155161            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 pagecounter 
    158162        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))) 
    160166             
     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