From 4f2925420f01d3d86c2b8855683f80502da8aacf Mon Sep 17 00:00:00 2001 From: Pablo Hoffman Date: Mon, 24 Aug 2009 09:54:02 -0300 Subject: [PATCH] minor improvements to Response.__repr__ --- scrapy/http/request/__init__.py | 2 +- scrapy/http/response/__init__.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/scrapy/http/request/__init__.py b/scrapy/http/request/__init__.py index 00bd88759..cc86b6f5a 100644 --- a/scrapy/http/request/__init__.py +++ b/scrapy/http/request/__init__.py @@ -97,7 +97,7 @@ class Request(object_ref): 'body': self.body, 'cookies': self.cookies, 'meta': self.meta, - } + } return "%s(%s)" % (self.__class__.__name__, repr(d)) def copy(self): diff --git a/scrapy/http/response/__init__.py b/scrapy/http/response/__init__.py index 49a57dc5a..000b710e7 100644 --- a/scrapy/http/response/__init__.py +++ b/scrapy/http/response/__init__.py @@ -55,9 +55,15 @@ class Response(object_ref): body = property(_get_body, _set_body) def __repr__(self): - return "%s(url=%s, headers=%s, status=%s, body=%s)" % \ - (type(self).__name__, repr(self.url), repr(self.headers), \ - repr(self.status), repr(self.body)) + d = { + 'status': self.status, + 'url': self.url, + 'headers': self.headers, + 'body': self.body, + 'meta': self.meta, + 'flags': self.flags, + } + return "%s(%s)" % (self.__class__.__name__, repr(d)) def __str__(self): flags = "(%s) " % ",".join(self.flags) if self.flags else ""