catch TooManyRedirects in safe_mode

This commit is contained in:
miguel
2012-02-03 14:16:23 -05:00
committed by Shivaram Lingamneni
parent 7c5151e8e7
commit 2a27b123fd
+9 -1
View File
@@ -631,7 +631,15 @@ class Request(object):
else:
raise
self._build_response(r)
# build_response can throw TooManyRedirects
try:
self._build_response(r)
except RequestException as e:
if self.config.get('safe_mode', False):
# In safe mode, catch the exception
self.response.error = e
else:
raise
# Response manipulation hook.
self.response = dispatch_hook('response', self.hooks, self.response)