From 5eb336215c573ae49774cab332a882b3a8ca830f Mon Sep 17 00:00:00 2001 From: Paul Tremberth Date: Thu, 16 Jan 2014 10:44:17 +0100 Subject: [PATCH] Make lxml smart strings functionality customizable --- scrapy/selector/unified.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scrapy/selector/unified.py b/scrapy/selector/unified.py index 368222768..babb65070 100644 --- a/scrapy/selector/unified.py +++ b/scrapy/selector/unified.py @@ -57,6 +57,7 @@ class Selector(object_ref): # set:trailing "set": "http://exslt.org/sets" } + _lxml_smart_strings = False def __init__(self, response=None, text=None, type=None, namespaces=None, _root=None, _expr=None): @@ -86,7 +87,7 @@ class Selector(object_ref): try: result = xpathev(query, namespaces=self.namespaces, - smart_strings=False) + smart_strings=self._lxml_smart_strings) except etree.XPathError: raise ValueError("Invalid XPath: %s" % query)