Set self.status immediately.
@@ -228,12 +228,15 @@ class HTTPRedirect(CherryPyException):
abs_urls.append(url)
self.urls = abs_urls
- status = int(status) if status is not None else self.default_status
- if not 300 <= status <= 399:
+ self.status = (
+ int(status)
+ if status is not None
+ else self.default_status
+ )
+ if not 300 <= self.status <= 399:
raise ValueError('status must be between 300 and 399.')
- self.status = status
- CherryPyException.__init__(self, abs_urls, status)
+ CherryPyException.__init__(self, abs_urls, self.status)
@classproperty
def default_status(cls):
