Issue #359 resolved

AttributeError: HTTPRedirect instance has no attribute 'args'

Anonymous created an issue

I am issuing the following for a redirect in CP 2.1 rc2: raise cherrypy._cperror.HTTPRedirect(url)

And receive the following: AttributeError: HTTPRedirect instance has no attribute 'args'

Reported by dwoodruff@nngov.com

Comments (5)

  1. Robert Brewer

    This occurs when an instance of HTTPRedirect is coerced to a string. This can happen with str(), with print statements, or with iteration over the exception (as occurs when returning an HTTPRedirect from a handler, rather than raising it).

    The HTTPRedirect exception needs to return a valid response from the first two cases. The third (return vs raise) is problematic, since it would be even *more* difficult to debug the case where a developer returns the exception instead of properly raising it.

  2. Log in to comment