mirror of https://github.com/scrapy/scrapy.git
Fixed encoding error with some item dropped messages. Closes #232
This commit is contained in:
parent
cb7cc7c8bb
commit
1d5a7df125
|
|
@ -15,7 +15,7 @@ class LogFormatter(object):
|
|||
return "Scraped %s in <%s>" % (item, request.url)
|
||||
|
||||
def dropped(self, item, exception, spider):
|
||||
return "Dropped %s - %s" % (item, str(exception))
|
||||
return "Dropped %s - %s" % (item, unicode(exception))
|
||||
|
||||
def passed(self, item, spider):
|
||||
return "Passed %s" % item
|
||||
|
|
|
|||
|
|
@ -22,6 +22,11 @@ class LoggingContribTest(unittest.TestCase):
|
|||
self.assertEqual(self.formatter.crawled(req, res, self.spider),
|
||||
"Crawled (200) <GET http://www.example.com> (referer: http://example.com) ['cached']")
|
||||
|
||||
def test_dropped(self):
|
||||
item = {}
|
||||
exception = Exception(u"\u2018")
|
||||
self.assertEqual(self.formatter.dropped(item, exception, self.spider),
|
||||
u"Dropped {} - \u2018")
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Reference in New Issue