Changeset 2829 for pykota/trunk

Show
Ignore:
Timestamp:
04/04/06 11:16:53 (19 years ago)
Author:
jerome
Message:

Did a pass with pylint.

Location:
pykota/trunk/bin
Files:
12 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/cupspykota

    r2803 r2829  
    4747from pykota.accounter import openAccounter 
    4848from pykota.ipp import IPPRequest, IPPError 
    49 from pykota.storage import PyKotaStorageError 
    5049         
    5150class FakeObject :         
     51    """Fake object.""" 
    5252    def __init__(self, name) : 
    5353        """Fake init.""" 
     
    135135                # see if the pid contained in the lock file is still running 
    136136                os.kill(pid, 0) 
    137             except OSError, e :     
    138                 if e.errno != errno.EPERM : 
     137            except OSError, err : 
     138                if err.errno != errno.EPERM : 
    139139                    # process doesn't exist anymore 
    140140                    os.remove(lockfilename) 
     
    318318            self.regainPriv()                          
    319319            inputfile = os.popen(jobticketcommand, "r") 
    320             for line in inputfile.xreadlines() : 
    321                 line = line.strip() 
    322                 if line in ("DENY", "AUTH=NO", "AUTH=IMPOSSIBLE") : 
    323                     self.logdebug("Seen %s command." % line) 
    324                     action = "DENY" 
    325                 elif line == "CANCEL" : 
    326                     self.logdebug("Seen CANCEL command.") 
    327                     action = "CANCEL" 
    328                 elif line.startswith("USERNAME=") :     
    329                     username = line.split("=", 1)[1].strip() 
    330                     self.logdebug("Seen new username [%s]" % username) 
    331                 elif line.startswith("BILLINGCODE=") :     
    332                     billingcode = line.split("=", 1)[1].strip() 
    333                     self.logdebug("Seen new billing code [%s]" % billingcode) 
     320            try : 
     321                for line in inputfile.xreadlines() : 
     322                    line = line.strip() 
     323                    if line in ("DENY", "AUTH=NO", "AUTH=IMPOSSIBLE") : 
     324                        self.logdebug("Seen %s command." % line) 
     325                        action = "DENY" 
     326                    elif line == "CANCEL" : 
     327                        self.logdebug("Seen CANCEL command.") 
     328                        action = "CANCEL" 
     329                    elif line.startswith("USERNAME=") :     
     330                        username = line.split("=", 1)[1].strip() 
     331                        self.logdebug("Seen new username [%s]" % username) 
     332                    elif line.startswith("BILLINGCODE=") :     
     333                        billingcode = line.split("=", 1)[1].strip() 
     334                        self.logdebug("Seen new billing code [%s]" % billingcode) 
     335            except IOError, msg :             
     336                self.logdebug("IOError while reading subprocess' output : %s" % msg) 
    334337            inputfile.close()     
    335338            self.dropPriv() 
     
    452455         
    453456        class DummyClass : 
     457            """Class used to avoid errors.""" 
    454458            operation_attributes = {} 
    455459            job_attributes = {} 
     
    12541258            wrapper.printInfo(_("Job %s interrupted by the administrator !") % wrapper.JobId, "warn") 
    12551259            retcode = 0 
    1256         except SystemExit, e :     
    1257             retcode = e.code 
     1260        except SystemExit, err :     
     1261            retcode = err.code 
    12581262        except :     
    12591263            try : 
  • pykota/trunk/bin/dumpykota

    r2622 r2829  
    2626 
    2727import sys 
    28 import os 
    2928 
    30 from pykota import version 
    31 from pykota.tool import PyKotaToolError, PyKotaCommandLineError, crashed, N_ 
     29from pykota.tool import PyKotaCommandLineError, crashed, N_ 
    3230from pykota.dumper import DumPyKota 
    3331 
  • pykota/trunk/bin/edpykota

    r2789 r2829  
    2626 
    2727import sys 
    28 import os 
    29  
    30 from pykota.tool import Percent, PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_ 
    31 from pykota.config import PyKotaConfigError 
    32 from pykota.storage import PyKotaStorageError, StorageUserPQuota, StorageGroupPQuota 
     28 
     29from pykota.tool import Percent, PyKotaTool, PyKotaCommandLineError, crashed, N_ 
     30from pykota.storage import StorageUserPQuota, StorageGroupPQuota 
    3331 
    3432__doc__ = N_("""edpykota v%(__version__)s (c) %(__years__)s %(__author__)s 
  • pykota/trunk/bin/pkbcodes

    r2789 r2829  
    2929import pwd 
    3030 
    31 from pykota.tool import Percent, PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_ 
     31from pykota.tool import Percent, PyKotaTool, PyKotaCommandLineError, crashed, N_ 
    3232from pykota.storage import StorageBillingCode 
    3333 
  • pykota/trunk/bin/pkmail

    r2622 r2829  
    3131import email 
    3232 
    33 from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_ 
     33from pykota.tool import PyKotaTool, PyKotaCommandLineError, crashed, N_ 
    3434     
    3535__doc__ = N_("""pkmail v%(__version__)s (c) %(__years__)s %(__author__)s 
  • pykota/trunk/bin/pknotify

    r2825 r2829  
    2626 
    2727import sys 
    28 import os 
    29 import popen2 
    3028import socket 
    3129import signal 
     
    3937    hasPAM = 1 
    4038 
    41 from pykota.tool import Tool, PyKotaToolError, PyKotaCommandLineError, crashed, N_ 
     39from pykota.tool import Tool, PyKotaCommandLineError, crashed, N_ 
    4240 
    4341__doc__ = N_("""pknotify v%(__version__)s (c) %(__years__)s %(__author__)s 
  • pykota/trunk/bin/pkprinters

    r2789 r2829  
    2929import pwd 
    3030 
    31 from pykota.tool import Percent, PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_ 
     31from pykota.tool import Percent, PyKotaTool, PyKotaCommandLineError, crashed, N_ 
    3232from pykota.storage import StoragePrinter 
    3333 
     
    227227                        if self.isValidName(pname) : 
    228228                            printer = StoragePrinter(self.storage, pname) 
    229                             self.modifyPrinter(printer, charges, perpage, perjob,\ 
     229                            self.modifyPrinter(printer, charges, perpage, perjob, \ 
    230230                                           description, passthrough, \ 
    231231                                           nopassthrough, maxjobsize) 
  • pykota/trunk/bin/pkturnkey

    r2745 r2829  
    223223        try : 
    224224            from pysnmp.asn1.encoding.ber.error import TypeMismatchError 
    225             from pysnmp.mapping.udp.error import SnmpOverUdpError 
    226225            from pysnmp.mapping.udp.role import Manager 
    227226            from pysnmp.proto.api import alpha 
     
    247246            tsp.close() 
    248247         
    249         def handleAnswer(wholeMsg, notusedhere, req): 
     248        def handleAnswer(wholemsg, notusedhere, req): 
    250249            """Decodes and handles the SNMP answer.""" 
    251250            ver = alpha.protoVersions[alpha.protoVersionId1] 
    252251            rsp = ver.Message() 
    253252            try : 
    254                 rsp.berDecode(wholeMsg) 
     253                rsp.berDecode(wholemsg) 
    255254            except TypeMismatchError, msg :     
    256255                raise "No SNMP !" 
     
    364363        """Intializes PyKota's database.""" 
    365364        if not self.config.isAdmin : 
    366             raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0],\ 
     365            raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], \ 
    367366                                   _("You're not allowed to use this command.")) 
    368367             
  • pykota/trunk/bin/pkusers

    r2792 r2829  
    2525# 
    2626 
    27 import os 
    2827import sys 
    2928import pwd 
    3029import grp 
    3130 
    32 from pykota.tool import Percent, PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_ 
     31from pykota.tool import Percent, PyKotaTool, PyKotaCommandLineError, crashed, N_ 
    3332from pykota.storage import StorageUser, StorageGroup 
    3433 
  • pykota/trunk/bin/pykosd

    r2692 r2829  
    7979 
    8080class PyKOSD(PyKotaTool) : 
     81    """A class for an On Screen Display print quota monitor.""" 
    8182    def main(self, args, options) : 
    8283        """Main function starts here.""" 
  • pykota/trunk/bin/pykotme

    r2622 r2829  
    2929import pwd 
    3030 
    31 from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_ 
     31from pykota.tool import PyKotaTool, PyKotaCommandLineError, crashed, N_ 
    3232 
    3333try : 
  • pykota/trunk/bin/warnpykota

    r2692 r2829  
    2929import pwd 
    3030 
    31 from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_ 
    32 from pykota.config import PyKotaConfigError 
    33 from pykota.storage import PyKotaStorageError 
     31from pykota.tool import PyKotaTool, PyKotaCommandLineError, crashed, N_ 
    3432 
    3533__doc__ = N_("""warnpykota v%(__version__)s (c) %(__years__)s %(__author__)s