Show
Ignore:
Timestamp:
05/29/07 23:03:12 (17 years ago)
Author:
jerome
Message:

Now the various delays are configurable when using hardware accounting,
through the newly introduced 'statusstabilizationdelay' and 'statusstabilizationloops'
directives in pykota.conf

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/config.py

    r3172 r3180  
    597597                return maxdelay 
    598598         
     599    def getStatusStabilizationLoops(self, printername) :     
     600        """Returns the number of times the printer must return the 'idle' status to consider it stable.""" 
     601        try :  
     602            stab = self.getPrinterOption(printername, "statusstabilizationloops") 
     603        except PyKotaConfigError :     
     604            return None         # tells to use hardcoded value 
     605        else :     
     606            try : 
     607                stab = int(stab) 
     608                if stab < 1 : 
     609                    raise ValueError 
     610            except (TypeError, ValueError) : 
     611                raise PyKotaConfigError, _("Incorrect value %s for the statusstabilizationloops directive in section %s") % (str(stab), printername) 
     612            else :     
     613                return stab 
     614         
     615    def getStatusStabilizationDelay(self, printername) :     
     616        """Returns the number of seconds to wait between two checks of the printer's status.""" 
     617        try :  
     618            stab = self.getPrinterOption(printername, "statusstabilizationdelay") 
     619        except PyKotaConfigError :     
     620            return None         # tells to use hardcoded value 
     621        else :     
     622            try : 
     623                stab = float(stab) 
     624                if stab < 0.25 : 
     625                    raise ValueError 
     626            except (TypeError, ValueError) : 
     627                raise PyKotaConfigError, _("Incorrect value %s for the statusstabilizationdelay directive in section %s") % (str(stab), printername) 
     628            else :     
     629                return stab 
     630         
    599631    def getWinbindSeparator(self) :           
    600632        """Returns the winbind separator's value if it is set, else None."""