comparison genshi/input.py @ 989:2d9346a99352 trunk

Remove unused isinstance checks.
author hodgestar
date Sat, 26 Jan 2013 11:38:35 +0000
parents 2bfd8f8d241c
children 0f4b2e892a48
comparison
equal deleted inserted replaced
988:480cf1be291a 989:2d9346a99352
364 364
365 def handle_starttag(self, tag, attrib): 365 def handle_starttag(self, tag, attrib):
366 fixed_attrib = [] 366 fixed_attrib = []
367 for name, value in attrib: # Fixup minimized attributes 367 for name, value in attrib: # Fixup minimized attributes
368 if value is None: 368 if value is None:
369 value = unicode(name) 369 value = name
370 elif not isinstance(value, unicode):
371 value = value.decode(self.encoding, 'replace')
372 fixed_attrib.append((QName(name), stripentities(value))) 370 fixed_attrib.append((QName(name), stripentities(value)))
373 371
374 self._enqueue(START, (QName(tag), Attrs(fixed_attrib))) 372 self._enqueue(START, (QName(tag), Attrs(fixed_attrib)))
375 if tag in self._EMPTY_ELEMS: 373 if tag in self._EMPTY_ELEMS:
376 self._enqueue(END, QName(tag)) 374 self._enqueue(END, QName(tag))
384 self._enqueue(END, QName(open_tag)) 382 self._enqueue(END, QName(open_tag))
385 if open_tag.lower() == tag.lower(): 383 if open_tag.lower() == tag.lower():
386 break 384 break
387 385
388 def handle_data(self, text): 386 def handle_data(self, text):
389 if not isinstance(text, unicode):
390 text = text.decode(self.encoding, 'replace')
391 self._enqueue(TEXT, text) 387 self._enqueue(TEXT, text)
392 388
393 def handle_charref(self, name): 389 def handle_charref(self, name):
394 if name.lower().startswith('x'): 390 if name.lower().startswith('x'):
395 text = unichr(int(name[1:], 16)) 391 text = unichr(int(name[1:], 16))
Copyright (C) 2012-2017 Edgewall Software