Changeset 1068

Show
Ignore:
Timestamp:
07/07/03 13:49:24 (21 years ago)
Author:
jalet
Message:

Lots of small fixes with the help of PyChecker?

Location:
pykota/trunk
Files:
14 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/NEWS

    r1067 r1068  
    2222PyKota NEWS : 
    2323 
     24    - 1.13 : 
     25     
     26        - The whole module code was passed through PyChecker and 
     27          several small code inconsistencies were fixed, 
     28          as well as a bug in the groups code. 
     29           
    2430    - 1.13alpha1 : 
    2531     
  • pykota/trunk/pykota/accounters/external.py

    r1041 r1068  
    2121# 
    2222# $Log$ 
     23# Revision 1.5  2003/07/07 11:49:24  jalet 
     24# Lots of small fixes with the help of PyChecker 
     25# 
    2326# Revision 1.4  2003/06/25 14:10:01  jalet 
    2427# Hey, it may work (edpykota --reset excepted) ! 
     
    8891             
    8992        # launches external accounter 
    90         infilename = tempfile.mktemp() 
    91         outfilename = tempfile.mktemp() 
    92         errfilename = tempfile.mktemp() 
     93        try : 
     94            infilename = tempfile.mkstemp()     # Python 2.3 
     95        except AttributeError :     
     96            infilename = tempfile.mktemp() 
     97        try : 
     98            outfilename = tempfile.mkstemp()    # Python 2.3 
     99        except AttributeError :     
     100            outfilename = tempfile.mktemp() 
     101        try : 
     102            errfilename = tempfile.mkstemp()    # Python 2.3 
     103        except AttributeError :     
     104            errfilename = tempfile.mktemp() 
    93105         
    94106        try : 
  • pykota/trunk/pykota/accounters/querying.py

    r1041 r1068  
    2121# 
    2222# $Log$ 
     23# Revision 1.5  2003/07/07 11:49:24  jalet 
     24# Lots of small fixes with the help of PyChecker 
     25# 
    2326# Revision 1.4  2003/06/25 14:10:01  jalet 
    2427# Hey, it may work (edpykota --reset excepted) ! 
     
    7073        if not printer.LastJob.Exists : 
    7174            # The printer hasn't been used yet, from PyKota's point of view 
    72             lastjob = None 
    7375            lastuser = user 
    7476            lastpagecounter = counterbeforejob 
    7577        else :     
    7678            # get last values from Quota Storage 
    77             lastjob = printer.LastJob 
    7879            lastuser = printer.LastJob.User 
    7980            lastpagecounter = printer.LastJob.PrinterPageCounter 
  • pykota/trunk/pykota/config.py

    r1041 r1068  
    2121# 
    2222# $Log$ 
     23# Revision 1.31  2003/07/07 11:49:24  jalet 
     24# Lots of small fixes with the help of PyChecker 
     25# 
    2326# Revision 1.30  2003/06/25 14:10:01  jalet 
    2427# Hey, it may work (edpykota --reset excepted) ! 
     
    142145# 
    143146 
    144 import sys 
    145147import os 
    146148import ConfigParser 
  • pykota/trunk/pykota/logger.py

    r1021 r1068  
    2121# 
    2222# $Log$ 
     23# Revision 1.8  2003/07/07 11:49:24  jalet 
     24# Lots of small fixes with the help of PyChecker 
     25# 
    2326# Revision 1.7  2003/06/10 16:37:54  jalet 
    2427# Deletion of the second user which is not needed anymore. 
     
    5053# 
    5154 
    52 import sys 
    53  
    5455class PyKotaLoggingError(Exception): 
    5556    """An exception for logging related stuff.""" 
  • pykota/trunk/pykota/loggers/system.py

    r952 r1068  
    2121# 
    2222# $Log$ 
     23# Revision 1.7  2003/07/07 11:49:24  jalet 
     24# Lots of small fixes with the help of PyChecker 
     25# 
    2326# Revision 1.6  2003/04/23 22:13:57  jalet 
    2427# Preliminary support for LPRng added BUT STILL UNTESTED. 
     
    4447# 
    4548 
    46 import sys 
    4749import syslog 
    4850 
  • pykota/trunk/pykota/reporters/text.py

    r1062 r1068  
    2121# 
    2222# $Log$ 
     23# Revision 1.4  2003/07/07 11:49:24  jalet 
     24# Lots of small fixes with the help of PyChecker 
     25# 
    2326# Revision 1.3  2003/07/05 07:46:50  jalet 
    2427# The previous bug fix was incomplete. 
     
    3235# 
    3336# 
    34  
    35 import sys 
    3637 
    3738from mx import DateTime 
  • pykota/trunk/pykota/requester.py

    r952 r1068  
    2121# 
    2222# $Log$ 
     23# Revision 1.8  2003/07/07 11:49:24  jalet 
     24# Lots of small fixes with the help of PyChecker 
     25# 
    2326# Revision 1.7  2003/04/23 22:13:57  jalet 
    2427# Preliminary support for LPRng added BUT STILL UNTESTED. 
     
    6871        raise PyKotaRequesterError, _("Unsupported requester backend %s") % backend 
    6972    else :     
    70         return getattr(requesterbackend, "Requester")(config, printername, args) 
     73        return getattr(requesterbackend, "Requester")(printername, args) 
  • pykota/trunk/pykota/requesters/external.py

    r952 r1068  
    2121# 
    2222# $Log$ 
     23# Revision 1.8  2003/07/07 11:49:24  jalet 
     24# Lots of small fixes with the help of PyChecker 
     25# 
    2326# Revision 1.7  2003/04/23 22:13:57  jalet 
    2427# Preliminary support for LPRng added BUT STILL UNTESTED. 
     
    5356class Requester : 
    5457    """A class to send queries to printers via external commands.""" 
    55     def __init__(self, config, printername, arguments) : 
     58    def __init__(self, printername, arguments) : 
    5659        """Sets instance vars depending on the current printer.""" 
    5760        self.printername = printername 
  • pykota/trunk/pykota/requesters/snmp.py

    r999 r1068  
    2121# 
    2222# $Log$ 
     23# Revision 1.11  2003/07/07 11:49:24  jalet 
     24# Lots of small fixes with the help of PyChecker 
     25# 
    2326# Revision 1.10  2003/05/22 12:56:06  jalet 
    2427# Uses SNMP version 1 instead of version 2c by default, which is probably 
     
    6669class Requester : 
    6770    """A class to send queries to printers via SNMP.""" 
    68     def __init__(self, config, printername, arguments) : 
     71    def __init__(self, printername, arguments) : 
    6972        """Sets instance vars depending on the current printer.""" 
    7073        self.printername = printername 
  • pykota/trunk/pykota/storages/ldapstorage.py

    r1067 r1068  
    2121# 
    2222# $Log$ 
     23# Revision 1.15  2003/07/07 11:49:24  jalet 
     24# Lots of small fixes with the help of PyChecker 
     25# 
    2326# Revision 1.14  2003/07/07 08:33:18  jalet 
    2427# Bug fix due to a typo in LDAP code 
     
    425428            for (groupquotaid, fields) in result : 
    426429                group = self.getGroup(fields.get("pykotaGroupName")[0]) 
    427                 if (names is None) or self.tool.matchString(user.Name, names) : 
     430                if (names is None) or self.tool.matchString(group.Name, names) : 
    428431                    grouppquota = self.getGroupPQuota(group, printer) 
    429432                    groupsandquotas.append((group, grouppquota)) 
  • pykota/trunk/pykota/storages/pgstorage.py

    r1067 r1068  
    2121# 
    2222# $Log$ 
     23# Revision 1.6  2003/07/07 11:49:24  jalet 
     24# Lots of small fixes with the help of PyChecker 
     25# 
    2326# Revision 1.5  2003/07/07 08:33:19  jalet 
    2427# Bug fix due to a typo in LDAP code 
     
    126129        except pg.error, msg :     
    127130            raise PyKotaStorageError, msg 
     131        else :     
     132            return result 
    128133             
    129134    def doQuote(self, field) : 
     
    329334    def addUserToGroup(self, user, group) :     
    330335        """Adds an user to a group.""" 
    331         result = self.doModify("SELECT COUNT(*) AS mexists FROM groupsmembers WHERE groupid=%s AND userid=%s" % (self.doQuote(group.ident), self.doQuote(user.ident))) 
     336        result = self.doSearch("SELECT COUNT(*) AS mexists FROM groupsmembers WHERE groupid=%s AND userid=%s" % (self.doQuote(group.ident), self.doQuote(user.ident))) 
    332337        try : 
    333             mexists = self.doParseResult(result)[0]["mexists"] 
    334         except TypeError :     
     338            mexists = int(result[0].get("mexists")) 
     339        except (IndexError, TypeError) :     
    335340            mexists = 0 
    336341        if not mexists :     
  • pykota/trunk/pykota/tool.py

    r1061 r1068  
    2121# 
    2222# $Log$ 
     23# Revision 1.44  2003/07/07 11:49:24  jalet 
     24# Lots of small fixes with the help of PyChecker 
     25# 
    2326# Revision 1.43  2003/07/04 09:06:32  jalet 
    2427# Small bug fix wrt undefined "LimitBy" field. 
     
    181184 
    182185import sys 
    183 import os 
    184186import fnmatch 
    185187import getopt 
     
    458460        adminmail = self.config.getAdminMail(printer.Name) 
    459461        mailto = self.config.getMailTo(printer.Name) 
    460         action = self.checkGroupPQuota(grouppquota, printer) 
     462        action = self.checkGroupPQuota(grouppquota) 
    461463        if action.startswith("POLICY_") : 
    462464            action = action[7:] 
  • pykota/trunk/pykota/version.py

    r1067 r1068  
    2121# 
    2222 
    23 __version__ = "1.13alpha1_unofficial" 
     23__version__ = "1.13_unofficial" 
    2424 
    2525__doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""