Edgewall Software

Changeset 1082 for trunk/genshi/input.py


Ignore:
Timestamp:
Nov 12, 2009, 6:01:52 PM (14 years ago)
Author:
cmlenz
Message:

More bits of 2to3 related cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/genshi/input.py

    r1080 r1082  
    1717
    1818from itertools import chain
    19 try:
    20     import htmlentitydefs as entities
    21     import HTMLParser as html
    22 except ImportError:
    23     from html import entities
    24     from html import parser as html
    25 try:
    26     from StringIO import StringIO
    27     BytesIO = StringIO
    28 except ImportError:
    29     from io import BytesIO, StringIO
     19import htmlentitydefs as entities
     20import HTMLParser as html
     21from StringIO import StringIO
    3022from xml.parsers import expat
    3123
    3224from genshi.core import Attrs, QName, Stream, stripentities
    33 from genshi.core import START, END, XML_DECL, DOCTYPE, TEXT, START_NS, END_NS, \
    34                         START_CDATA, END_CDATA, PI, COMMENT
     25from genshi.core import START, END, XML_DECL, DOCTYPE, TEXT, START_NS, \
     26                        END_NS, START_CDATA, END_CDATA, PI, COMMENT
    3527
    3628__all__ = ['ET', 'ParseError', 'XMLParser', 'XML', 'HTMLParser', 'HTML']
    3729__docformat__ = 'restructuredtext en'
     30
    3831
    3932def ET(element):
     
    178171    def _build_foreign(self, context, base, sysid, pubid):
    179172        parser = self.expat.ExternalEntityParserCreate(context)
    180         parser.ParseFile(BytesIO(self._external_dtd))
     173        parser.ParseFile(StringIO(self._external_dtd))
    181174        return 1
    182175
     
    276269    :raises ParseError: if the XML text is not well-formed
    277270    """
    278     return Stream(list(XMLParser(BytesIO(text))))
     271    return Stream(list(XMLParser(StringIO(text))))
    279272
    280273
     
    430423                        fails
    431424    """
    432     return Stream(list(HTMLParser(BytesIO(text), encoding=encoding)))
     425    return Stream(list(HTMLParser(StringIO(text), encoding=encoding)))
     426
    433427
    434428def _coalesce(stream):
Note: See TracChangeset for help on using the changeset viewer.