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/constants.py

    r3175 r3180  
    2424"""This module contains the definitions of constants used by PyKota.""" 
    2525 
    26 ITERATIONDELAY = 4      # time to sleep between two loops 
    27 STABILIZATIONDELAY = 5  # number of consecutive times the idle status must be seen before we consider it to be stable 
     26STATUSSTABILIZATIONDELAY = 4.0 # time to sleep between two loops 
     27STATUSSTABILIZATIONLOOPS = 5  # number of consecutive times the 'idle' status must be seen before we consider it to be stable 
    2828NOPRINTINGMAXDELAY = 60 # The printer must begin to print within 60 seconds by default. 
     29 
     30def get(application, varname) : 
     31    """Retrieves the value of a particular printer variable from configuration file, else a constant defined here.""" 
     32    pname = application.PrinterName 
     33    try : 
     34        value = getattr(application.config, "get%(varname)s" % locals())(pname) 
     35        if value is None : 
     36            raise TypeError     # Use hardcoded value 
     37    except (TypeError, AttributeError) : # NB : AttributeError in testing mode because I'm lazy ! 
     38        value = globals().get(varname.upper()) 
     39        application.logdebug("No value defined for %(varname)s for printer %(pname)s, using %(value)s." % locals()) 
     40    return value