diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2000-12-28 18:43:02 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2000-12-28 18:43:02 (GMT) |
commit | 011ea47577eca09abe0d78aece95618e66554f66 (patch) | |
tree | b8d001b630c764afb01d761884dfb43a61be00a3 /Lib | |
parent | 156c337f665a713767fa63b6c16ee6e9dea16250 (diff) | |
download | cpython-011ea47577eca09abe0d78aece95618e66554f66.zip cpython-011ea47577eca09abe0d78aece95618e66554f66.tar.gz cpython-011ea47577eca09abe0d78aece95618e66554f66.tar.bz2 |
Merge with 1.8 of pulldom.py:
Use types.UnicodeType if available, not type(u"").
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/xml/dom/pulldom.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/xml/dom/pulldom.py b/Lib/xml/dom/pulldom.py index 7f5ef79..5fc215a 100644 --- a/Lib/xml/dom/pulldom.py +++ b/Lib/xml/dom/pulldom.py @@ -1,5 +1,11 @@ import xml.sax import xml.sax.handler +import types + +try: + _StringTypes = [types.StringType, types.UnicodeType] +except AttributeError: + _StringTypes = [types.StringType] START_ELEMENT = "START_ELEMENT" END_ELEMENT = "END_ELEMENT" @@ -235,7 +241,7 @@ default_bufsize = (2 ** 14) - 20 def parse(stream_or_string, parser=None, bufsize=None): if bufsize is None: bufsize = default_bufsize - if type(stream_or_string) in [type(""), type(u"")]: + if type(stream_or_string) in _StringTypes: stream = open(stream_or_string) else: stream = stream_or_string |