(self, *args, **kwargs)
return cls(*args, **kwargs)
Create a new Response with the same attributes except for those given new values
Create a new Response with the same attributes except for those given new values
Create a new Response with the same attributes except for those given new values
def replace(self, *args, **kwargs):
        """Create a new Response with the same attributes except for those given new values"""
        for x in self.attributes:
            kwargs.setdefault(x, getattr(self, x))
        cls = kwargs.pop('cls', self.__class__)
        return cls(*args, **kwargs)
def replace ( self , * args , * * kwargs ) : for x in self . attributes : kwargs . setdefault ( x , getattr ( self , x ) ) cls = kwargs . pop ( 'cls' , self . __class__ ) return cls ( * args , * * kwargs )