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:
3985f4b
)
Made redirections a bit more flexible.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Mon, 2 Sep 2013 01:19:03 +0000
(
03:19
+0200)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Mon, 2 Sep 2013 01:19:03 +0000
(
03:19
+0200)
wrw/resp.py
patch
|
blob
|
blame
|
history
diff --git
a/wrw/resp.py
b/wrw/resp.py
index
50ac6b1
..
fbb056f
100644
(file)
--- a/
wrw/resp.py
+++ b/
wrw/resp.py
@@
-62,14
+62,20
@@
class notfound(httperror):
return super(notfound, self).__init__(404)
class redirect(dispatch.restart):
return super(notfound, self).__init__(404)
class redirect(dispatch.restart):
- def __init__(self, url, status = 303):
+ bases = {"url": proto.requrl,
+ "script": proto.scripturl,
+ "site": proto.siteurl}
+
+ def __init__(self, url, status = 303, base = "url"):
super(redirect, self).__init__()
self.url = url
self.status = status
super(redirect, self).__init__()
self.url = url
self.status = status
+ self.bases[base]
+ self.base = base
def handle(self, req):
req.status(self.status, "Redirect")
def handle(self, req):
req.status(self.status, "Redirect")
- req.ohead["Location"] = proto.appendurl(
proto.requrl
(req), self.url)
+ req.ohead["Location"] = proto.appendurl(
self.bases[self.base]
(req), self.url)
req.ohead["Content-Length"] = 0
return []
req.ohead["Content-Length"] = 0
return []