Dolda2000 GitWeb
/
wrw.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
bb80acb
)
Added a redirection restart.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Sun, 6 Nov 2011 19:56:40 +0000
(20:56 +0100)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Sun, 6 Nov 2011 19:56:40 +0000
(20:56 +0100)
wrw/resp.py
patch
|
blob
|
blame
|
history
diff --git
a/wrw/resp.py
b/wrw/resp.py
index
2e26ccf
..
8216d23
100644
(file)
--- a/
wrw/resp.py
+++ b/
wrw/resp.py
@@
-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 []