diff options
| author | scoder <none@none> | 2008-05-24 10:09:52 +0200 |
|---|---|---|
| committer | scoder <none@none> | 2008-05-24 10:09:52 +0200 |
| commit | 6780f64444f3f5cb8ad55f15ebaa5a7a6e2bb3fc (patch) | |
| tree | c19b02fb2ee358994d80a6428285690d1682f52a /src/lxml/cssselect.py | |
| parent | 81c5b2400ee7a0fce0d18e94cff4a1c9377a3b18 (diff) | |
| download | python-lxml-6780f64444f3f5cb8ad55f15ebaa5a7a6e2bb3fc.tar.gz | |
[svn r3740] r4335@delle: sbehnel | 2008-05-24 09:55:10 +0200
Py3 fix
--HG--
branch : trunk
Diffstat (limited to 'src/lxml/cssselect.py')
| -rw-r--r-- | src/lxml/cssselect.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lxml/cssselect.py b/src/lxml/cssselect.py index 5fe70033..c0792935 100644 --- a/src/lxml/cssselect.py +++ b/src/lxml/cssselect.py @@ -10,6 +10,11 @@ from lxml import etree __all__ = ['SelectorSyntaxError', 'ExpressionError', 'CSSSelector'] +try: + _basestring = basestring +except NameError: + _basestring = str + class SelectorSyntaxError(SyntaxError): pass @@ -501,7 +506,7 @@ _id_re = re.compile(r'^(\w*)#(\w+)\s*$') _class_re = re.compile(r'^(\w*)\.(\w+)\s*$') def css_to_xpath(css_expr, prefix='descendant-or-self::'): - if isinstance(css_expr, basestring): + if isinstance(css_expr, _basestring): match = _el_re.search(css_expr) if match is not None: return '%s%s' % (prefix, match.group(0).strip()) |
