Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

fixed bug in previous commit

Pablo Hoffmand8c04407002e
diff --git a/scrapy/trunk/scrapy/http/request/__init__.py b/scrapy/trunk/scrapy/http/request/__init__.py
index e23f77280..71343f4cb 100644
--- a/scrapy/trunk/scrapy/http/request/__init__.py
+++ b/scrapy/trunk/scrapy/http/request/__init__.py
@@ -87,7 +87,7 @@ class Request(object):
"""Create a new Request with the same attributes except for those
given new values.
"""
- return self.__class__(url=self.url if url is None else self.url,
+ return self.__class__(url=self.url if url is None else url,
callback=callback,
method=self.method if method is None else method,
headers=copy.deepcopy(self.headers) if headers is None else headers,
diff --git a/scrapy/trunk/scrapy/tests/test_http_request.py b/scrapy/trunk/scrapy/tests/test_http_request.py
index 0b658ff01..f295b5b83 100644
--- a/scrapy/trunk/scrapy/tests/test_http_request.py
+++ b/scrapy/trunk/scrapy/tests/test_http_request.py
@@ -156,7 +156,8 @@ class RequestTest(unittest.TestCase):
# Empty attributes (which may fail if not compared properly)
r3 = Request("http://www.example.com", meta={'a': 1}, dont_filter=True)
- r4 = r3.replace(body='', meta={}, dont_filter=False)
+ r4 = r3.replace(url="http://www.example.com/2", body='', meta={}, dont_filter=False)
+ self.assertEqual(r4.url, "http://www.example.com/2")
self.assertEqual(r4.body, '')
self.assertEqual(r4.meta, {})
assert r4.dont_filter is False