Changeset 653

Show
Ignore:
Timestamp:
09/03/05 00:47:48 (19 years ago)
Author:
jerome
Message:

Fixed some problems with the help of pychecker

Location:
tea4cups/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • tea4cups/trunk/NEWS

    r652 r653  
    2323Tea4CUPS News : 
    2424 
     25  * 3.02 : 
     26   
     27    - Fixed some problems thanks to pychecker. 
     28     
    2529  * 3.01 : 
    2630   
  • tea4cups/trunk/tea4cups

    r652 r653  
    2727import os 
    2828import pwd 
    29 import popen2 
    3029import errno 
    3130import md5 
     
    3433import tempfile 
    3534import ConfigParser 
    36 import select 
    3735import signal 
    38 import time 
    39 from struct import unpack 
    40  
    41 version = "3.01_unofficial" 
     36from struct import pack, unpack 
     37 
     38version = "3.02_unofficial" 
    4239 
    4340class TeeError(Exception): 
     
    183180            return "" 
    184181        else :     
    185             buffer = [] 
    186             buffer.append("IPP version : %s.%s" % self.version) 
    187             buffer.append("IPP operation Id : 0x%04x" % self.operation_id) 
    188             buffer.append("IPP request Id : 0x%08x" % self.request_id) 
     182            mybuffer = [] 
     183            mybuffer.append("IPP version : %s.%s" % self.version) 
     184            mybuffer.append("IPP operation Id : 0x%04x" % self.operation_id) 
     185            mybuffer.append("IPP request Id : 0x%08x" % self.request_id) 
    189186            for attrtype in self.attributes_types : 
    190187                attrdict = getattr(self, "%s_attributes" % attrtype) 
    191188                if attrdict : 
    192                     buffer.append("%s attributes :" % attrtype.title()) 
     189                    mybuffer.append("%s attributes :" % attrtype.title()) 
    193190                    for key in attrdict.keys() : 
    194                         buffer.append("  %s : %s" % (key, attrdict[key])) 
     191                        mybuffer.append("  %s : %s" % (key, attrdict[key])) 
    195192            if self.data :             
    196                 buffer.append("IPP datas : %s" % repr(message.data)) 
    197             return "\n".join(buffer) 
     193                mybuffer.append("IPP datas : %s" % repr(self.data)) 
     194            return "\n".join(mybuffer) 
    198195         
    199196    def dump(self) :     
     
    202199           Returns the message as a string of text. 
    203200        """     
    204         buffer = [] 
     201        mybuffer = [] 
    205202        if None not in (self.version, self.operation_id, self.request_id) : 
    206             buffer.append(chr(self.version[0]) + chr(self.version[1])) 
    207             buffer.append(pack(">H", self.operation_id)) 
    208             buffer.append(pack(">I", self.request_id)) 
     203            mybuffer.append(chr(self.version[0]) + chr(self.version[1])) 
     204            mybuffer.append(pack(">H", self.operation_id)) 
     205            mybuffer.append(pack(">I", self.request_id)) 
    209206            for attrtype in self.attributes_types : 
    210207                tagprinted = 0 
    211208                for (attrname, value) in getattr(self, "%s_attributes" % attrtype).items() : 
    212209                    if not tagprinted : 
    213                         buffer.append(chr(self.dictags["%s-attributes-tag" % attrtype])) 
     210                        mybuffer.append(chr(self.dictags["%s-attributes-tag" % attrtype])) 
    214211                        tagprinted = 1 
    215212                    if type(value) != type([]) : 
    216213                        value = [ value ] 
    217214                    for (vtype, val) in value : 
    218                         buffer.append(chr(self.dictags[vtype])) 
    219                         buffer.append(pack(">H", len(attrname))) 
    220                         buffer.append(attrname) 
     215                        mybuffer.append(chr(self.dictags[vtype])) 
     216                        mybuffer.append(pack(">H", len(attrname))) 
     217                        mybuffer.append(attrname) 
    221218                        if vtype in ("integer", "enum") : 
    222                             buffer.append(pack(">H", 4)) 
    223                             buffer.append(pack(">I", val)) 
     219                            mybuffer.append(pack(">H", 4)) 
     220                            mybuffer.append(pack(">I", val)) 
    224221                        elif vtype == "boolean" : 
    225                             buffer.append(pack(">H", 1)) 
    226                             buffer.append(chr(val)) 
     222                            mybuffer.append(pack(">H", 1)) 
     223                            mybuffer.append(chr(val)) 
    227224                        else :     
    228                             buffer.append(pack(">H", len(val))) 
    229                             buffer.append(val) 
    230             buffer.append(chr(self.dictags["end-of-attributes-tag"])) 
    231         buffer.append(self.data)     
    232         return "".join(buffer) 
     225                            mybuffer.append(pack(">H", len(val))) 
     226                            mybuffer.append(val) 
     227            mybuffer.append(chr(self.dictags["end-of-attributes-tag"])) 
     228        mybuffer.append(self.data)     
     229        return "".join(mybuffer) 
    233230             
    234231    def parse(self) : 
     
    781778        if pid == 0 : 
    782779            if self.InputFile is None : 
    783                 f = open(self.dataFile, "rb") 
     780                f = open(self.DataFile, "rb") 
    784781                os.dup2(f.fileno(), 0) 
    785782                f.close()