summaryrefslogtreecommitdiff
path: root/src/lxml/cssselect.py
diff options
context:
space:
mode:
authorscoder <none@none>2008-05-24 10:09:52 +0200
committerscoder <none@none>2008-05-24 10:09:52 +0200
commit6780f64444f3f5cb8ad55f15ebaa5a7a6e2bb3fc (patch)
treec19b02fb2ee358994d80a6428285690d1682f52a /src/lxml/cssselect.py
parent81c5b2400ee7a0fce0d18e94cff4a1c9377a3b18 (diff)
downloadpython-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.py7
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())