Changeset 2272 for pykota

Show
Ignore:
Timestamp:
05/29/05 00:00:43 (19 years ago)
Author:
jerome
Message:

Unsupported attributes are now parsed correctly like the supported ones.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/ipp.py

    r2254 r2272  
    4242        return self.message 
    4343    __str__ = __repr__ 
     44 
     45attributes_types = ("operation", "job", "printer", "unsupported") 
    4446 
    4547class IPPMessage : 
     
    7173        self.debug = debug 
    7274        self.data = data 
    73         self.operation_attributes = {} 
    74         self.job_attributes = {} 
    75         self.printer_attributes = {} 
    76         self.unsupported_attributes = {} 
     75        for attrtype in attributes_types : 
     76            setattr(self, "%s_attributes" % attrtype, {}) 
    7777        self.tags = [ None ] * 256      # by default all tags reserved 
    7878         
     
    146146        oldval = self._curdict.setdefault(name, []) 
    147147        oldval.append((tagtype, value)) 
    148         self.printInfo("%s(%s) %s" % (name, tagtype, value)) 
     148        self.printInfo("%s(%s) : %s" % (name, tagtype, value)) 
    149149        return posend - self.position 
    150150         
     
    201201             
    202202        # Now transform all one-element lists into single values 
    203         for attrtype in ("operation", "job", "printer") : 
     203        for attrtype in attributes_types : 
    204204            attrdict = getattr(self, "%s_attributes" % attrtype) 
    205205            for (key, value) in attrdict.items() : 
     
    217217        print "IPP operation Id : %s" % message.operation_id 
    218218        print "IPP request Id : %s" % message.request_id 
    219         for attrtype in ("operation", "job", "printer", "unsupported") : 
     219        for attrtype in attributes_types : 
    220220            attrdict = getattr(message, "%s_attributes" % attrtype) 
    221221            if attrdict :