def put(self, path, data='', content_type='application/octet-stream', follow=False, max_page_redirect=2, secure=False, **extra): """ Send a resource to the server using PUT. """ response = super(Client, self).put(path, data=data, content_type=content_type, secure=secure, **extra) if follow: response = self._handle_redirects(response, max_page_redirect, **extra) return response
if len(redirect_chain) > 20: # Such a lengthy chain likely also means a loop, but one with # a growing path, changing view, or changing query argument; # 20 is the value of "network.http.redirection-limit" from Firefox. raise RedirectCycleError("Too many redirects.", last_response=response)
RedirectCycleError: Redirect loop detected.
I have a view that looks for a certain condition. If that condition is not met then I redirect to a second view. That second view does something then most of the time will redirect back to the first view. This works well in reality, but in testing results in 'RedirectCycleError: Redirect loop detected' when the second view redirects back to the first.