From 66852b8291355d1f55fbf37f027e985287159cd4 Mon Sep 17 00:00:00 2001 From: elpolilla Date: Wed, 7 Jan 2009 12:09:47 +0000 Subject: [PATCH] Small bugfix in selectors constructor regarding strings and unicodes --HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40670 --- scrapy/trunk/scrapy/xpath/selector.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scrapy/trunk/scrapy/xpath/selector.py b/scrapy/trunk/scrapy/xpath/selector.py index f614f9f5f..da939bb91 100644 --- a/scrapy/trunk/scrapy/xpath/selector.py +++ b/scrapy/trunk/scrapy/xpath/selector.py @@ -3,7 +3,7 @@ import libxml2 from scrapy.http import Response from scrapy.xpath.extension import Libxml2Document from scrapy.xpath.constructors import xmlDoc_from_html, xmlDoc_from_xml -from scrapy.utils.python import flatten +from scrapy.utils.python import flatten, unicode_to_str from scrapy.utils.misc import extract_regex class XPathSelector(object): @@ -28,7 +28,7 @@ class XPathSelector(object): self.doc = Libxml2Document(response, constructor=constructor) self.xmlNode = self.doc.xmlDoc elif text: - response = Response(domain=None, url=None, body=str(text)) + response = Response(domain=None, url=None, body=unicode_to_str(text)) self.doc = Libxml2Document(response, constructor=constructor) self.xmlNode = self.doc.xmlDoc self.expr = expr