Skip to content

Commit 1627320

Browse files
committed
Merge branch '0.14' of github.com:scrapy/scrapy into 0.14
2 parents 1423140 + 0de3fb4 commit 1627320

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

scrapy/core/engine.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,13 @@ def _next_request(self, spider):
106106
if slot.start_requests and not self._needs_backout(spider):
107107
try:
108108
request = slot.start_requests.next()
109-
self.crawl(request, spider)
110109
except StopIteration:
111110
slot.start_requests = None
111+
except Exception, exc:
112+
log.err(None, 'Obtaining request from start requests', \
113+
spider=spider)
114+
else:
115+
self.crawl(request, spider)
112116

113117
if self.spider_is_idle(spider) and slot.close_if_idle:
114118
self._spider_idle(spider)

scrapy/http/request/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ def _set_url(http://github.com/self,%20url):
5454
if self.encoding is None:
5555
raise TypeError('Cannot convert unicode url - %s has no encoding' %
5656
type(self).__name__)
57-
unicode_url = url if isinstance(url, unicode) else url.decode(self.encoding)
58-
self._url = safe_url_string(unicode_url, self.encoding)
57+
self._set_url(url.encode(self.encoding))
5958
else:
6059
raise TypeError('Request url must be str or unicode, got %s:' % type(url).__name__)
6160
if ':' not in self._url:

scrapy/tests/test_http_request.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,12 @@ def test_body(self):
108108
self.assertEqual(r4.body, "Price: \xa3100")
109109

110110
def test_ajax_url(self):
111+
# ascii url
111112
r = self.request_class(url="http://www.example.com/ajax.html#!key=value")
112113
self.assertEqual(r.url, "http://www.example.com/ajax.html?_escaped_fragment_=key=value")
114+
# unicode url
115+
r = self.request_class(url=u"http://www.example.com/ajax.html#!key=value")
116+
self.assertEqual(r.url, "http://www.example.com/ajax.html?_escaped_fragment_=key=value")
113117

114118
def test_copy(self):
115119
"""Test Request copy"""

0 commit comments

Comments
 (0)