X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=wrw%2Fresp.py;h=9d8542b54aab3c5807320c721f4f301b12ac9119;hb=784d41f352527072fd9e26488f79e163868619b9;hp=2e26ccf778f44966bc20cf53a4fe413bc71f7b4e;hpb=c3b08e88c7940256b95a319d1f7f6cf6a40b25c6;p=wrw.git diff --git a/wrw/resp.py b/wrw/resp.py index 2e26ccf..9d8542b 100644 --- a/wrw/resp.py +++ b/wrw/resp.py @@ -46,9 +46,9 @@ class usererror(dispatch.restart): return [skelfor(req).error(self.message, self.detail)] class message(dispatch.restart): - def __init__(self, message, detail): + def __init__(self, msg, detail): super(message, self).__init__() - self.message = message + self.message = msg self.detail = detail def handle(self, req): @@ -70,3 +70,14 @@ class httperror(usererror): class notfound(httperror): def __init__(self): return super(notfound, self).__init__(404) + +class redirect(dispatch.restart): + def __init__(self, url, status = 303): + super(redirect, self).__init__() + self.url = url + self.status = status + + def handle(self, req): + req.status(self.status, "Redirect") + req.ohead["Location"] = proto.appendurl(proto.requrl(req), self.url) + return []