Changeset 1937:1b7656adef5d

Show
Ignore:
Timestamp:
02/24/10 15:43:09 (5 months ago)
Author:
Daniel Grana <dangra@…>
Children:
1938:79f7da288813, 1944:29080aae4808
Branch:
default
Message:

Add missing priority and errback arguments to Request.replace method signature

Location:
scrapy
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • scrapy/http/request/__init__.py

    r1782 r1937  
    9797        return self.replace() 
    9898 
    99     def replace(self, url=None, callback=None, method=None, headers=None, body=None,  
    100                 cookies=None, meta=None, encoding=None, dont_filter=None): 
     99    def replace(self, url=None, callback=None, method=None, headers=None, body=None, \ 
     100                cookies=None, meta=None, encoding=None, priority=None, \ 
     101                dont_filter=None, errback=None): 
    101102        """Create a new Request with the same attributes except for those 
    102103        given new values. 
     
    110111                              meta=self.meta if meta is None else meta, 
    111112                              encoding=self.encoding if encoding is None else encoding, 
    112                               dont_filter=self.dont_filter if dont_filter is None else dont_filter) 
     113                              priority=self.priority if priority is None else priority, 
     114                              dont_filter=self.dont_filter if dont_filter is None else dont_filter, 
     115                              errback=errback) 
  • scrapy/tests/test_http_request.py

    r1813 r1937  
    33import unittest 
    44import xmlrpclib 
     5from inspect import getargspec 
    56from cStringIO import StringIO 
    67from urlparse import urlparse 
     
    171172        assert r4.dont_filter is False 
    172173 
     174        # __init__ and replace() signatures must be equal unles *args,**kwargs is used 
     175        i_args, i_varargs, i_varkwargs, _ = getargspec(self.request_class.__init__) 
     176        self.assertFalse(bool(i_varargs) ^ bool(i_varkwargs)) 
     177        if not i_varargs: 
     178            r_args, _, _, _ = getargspec(self.request_class.replace) 
     179            self.assertEqual(i_args, r_args) 
     180 
    173181    def test_weakref_slots(self): 
    174182        """Check that classes are using slots and are weak-referenceable"""