Changeset 2425 for pykota/trunk

Show
Ignore:
Timestamp:
09/05/05 15:02:58 (19 years ago)
Author:
jerome
Message:

Allows 'hardware(pjl:port)' and 'hardware(snmp:community)'.

Location:
pykota/trunk
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/conf/pykota.conf.sample

    r2406 r2425  
    401401#  
    402402#               Extracts the printer's internal page counter via PJL queries over port tcp/9100. 
     403# 
     404#         Advanced uses : 
     405# 
     406#             accounter: hardware(snmp:MyCommunity) 
     407# 
     408#               To use a different SNMP community name than the default one (which is 'public') 
     409# 
     410#             accounter: hardware(pjl:9101)  
     411# 
     412#               To use a different port than the default one (which is 9100) 
     413# 
    403414# 
    404415#         Other Examples :  
  • pykota/trunk/NEWS

    r2420 r2425  
    2222PyKota NEWS : 
    2323        
     24    - 1.23alpha26 : 
     25     
     26        - Allows parametrized pjl and snmp hardware accounting methods, 
     27          to be able to respectively set the TCP port and the SNMP 
     28          community. 
     29           
    2430    - 1.23alpha25 : 
    2531     
  • pykota/trunk/pykota/accounters/hardware.py

    r2409 r2425  
    111111        commandline = self.arguments.strip() % locals() 
    112112        cmdlower = commandline.lower() 
    113         if cmdlower == "snmp" : 
     113        if (cmdlower == "snmp") or cmdlower.startswith("snmp:") : 
    114114            return snmp.Handler(self, printer).retrieveInternalPageCounter() 
    115         elif cmdlower == "pjl" : 
     115        elif (cmdlower == "pjl") or cmdlower.startswith("pjl:") : 
    116116            return pjl.Handler(self, printer).retrieveInternalPageCounter() 
    117117             
  • pykota/trunk/pykota/accounters/pjl.py

    r2423 r2425  
    6060        self.parent = parent 
    6161        self.printerHostname = printerhostname 
    62         self.port = 9100 
     62        try : 
     63            self.port = int(self.parent.arguments.split(":")[1].strip()) 
     64        except (IndexError, ValueError) : 
     65            self.port = 9100 
    6366        self.printerInternalPageCounter = self.printerStatus = None 
    6467        self.timedout = 0 
  • pykota/trunk/pykota/accounters/snmp.py

    r2423 r2425  
    6868            self.parent = parent 
    6969            self.printerHostname = printerhostname 
    70             self.community = "public" 
     70            try : 
     71                self.community = self.parent.arguments.split(":")[1].strip() 
     72            except IndexError :     
     73                self.community = "public" 
    7174            self.port = 161 
    7275            self.printerInternalPageCounter = None 
  • pykota/trunk/pykota/version.py

    r2420 r2425  
    2222# 
    2323 
    24 __version__ = "1.23alpha25_unofficial" 
     24__version__ = "1.23alpha26_unofficial" 
    2525 
    2626__doc__ = "PyKota : a complete Printing Quota Solution for CUPS and LPRng."