Small bugfix in selectors constructor regarding strings and unicodes

--HG--
extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40670
This commit is contained in:
elpolilla 2009-01-07 12:09:47 +00:00
parent 2c2dc61766
commit 66852b8291
1 changed files with 2 additions and 2 deletions

View File

@ -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