- Timestamp:
- 05/14/05 14:56:24 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
tea4cups/trunk/tea4cups
r632 r633 143 143 self.parse() 144 144 145 def printInfo(self, msg) : 146 """Prints a debug message.""" 147 if self.debug : 148 sys.stderr.write("%s\n" % msg) 149 sys.stderr.flush() 150 145 151 def parseTag(self) : 146 152 """Extracts information from an IPP tag.""" 147 153 pos = self.position 148 valuetag= self.tags[ord(self.data[pos])]154 tagtype = self.tags[ord(self.data[pos])] 149 155 pos += 1 150 156 posend = pos2 = pos + 2 … … 159 165 posend = pos2 + valuelength 160 166 value = self.data[pos2:posend] 161 if valuetagin ("integer", "enum") :167 if tagtype in ("integer", "enum") : 162 168 value = unpack(">I", value) 163 169 oldval = self._curdict.setdefault(name, []) 164 oldval.append(( valuetag, value))165 self.printInfo("%s(%s) %s" % (name, valuetag, value))170 oldval.append((tagtype, value)) 171 self.printInfo("%s(%s) %s" % (name, tagtype, value)) 166 172 return posend - self.position 167 173 … … 183 189 self._curdict = self.printer_attributes 184 190 return self.parseTag() 185 186 def printInfo(self, msg) :187 """Prints a debug message."""188 if self.debug :189 sys.stderr.write("%s\n" % msg)190 sys.stderr.flush()191 191 192 192 def parse(self) : 193 193 """Parses an IPP Message. 194 194 195 NB : Only a subset of RFC2910 is implemented. 196 We are only interested in textual informations for now anyway. 195 Implemented with RFC2910 as a reference. 196 NB : only a subset is actually implemented, but CUPS generated 197 message files are completely decoded. 197 198 """ 198 199 self._curname = None