Dolda2000 GitWeb
/
wrw.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Made appropriate Python3 changes.
[wrw.git]
/
wrw
/
resp.py
diff --git
a/wrw/resp.py
b/wrw/resp.py
index
9ad22d1
..
b62ce0e
100644
(file)
--- a/
wrw/resp.py
+++ b/
wrw/resp.py
@@
-1,21
+1,21
@@
-import dispatch, proto, env
-from sp import xhtml
+
from .
import dispatch, proto, env
+from
.
sp import xhtml
h = xhtml.cons()
__all__ = ["skeleton", "skelfor", "setskel", "usererror"]
class skeleton(object):
h = xhtml.cons()
__all__ = ["skeleton", "skelfor", "setskel", "usererror"]
class skeleton(object):
- def page(self, title, *content):
- return
h.html(self.head(title), h.body(*content
))
+ def page(self,
req,
title, *content):
+ return
xhtml.forreq(req, h.html(self.head(req, title), h.body(*content)
))
- def head(self, title):
+ def head(self,
req,
title):
return xhtml.head(title=title)
return xhtml.head(title=title)
- def error(self, message, *detail):
- return self.page(message, h.h1(message), h.p(*detail))
+ def error(self,
req,
message, *detail):
+ return self.page(
req,
message, h.h1(message), h.p(*detail))
- def message(self, message, *detail):
- return self.page(message, h.h1(message), h.p(*detail))
+ def message(self,
req,
message, *detail):
+ return self.page(
req,
message, h.h1(message), h.p(*detail))
defskel = env.var(skeleton())
defskel = env.var(skeleton())
@@
-28,21
+28,21
@@
def setskel(req, skel):
class usererror(dispatch.restart):
def __init__(self, message, *detail):
class usererror(dispatch.restart):
def __init__(self, message, *detail):
- super(
usererror, self
).__init__()
+ super().__init__()
self.message = message
self.detail = detail
def handle(self, req):
self.message = message
self.detail = detail
def handle(self, req):
- return
xhtml.forreq(req, skelfor(req).error(self.message, *self.detail)
)
+ return
skelfor(req).error(req, self.message, *self.detail
)
class message(dispatch.restart):
class message(dispatch.restart):
- def __init__(self, m
sg
, *detail):
- super(
message, self
).__init__()
- self.message = m
sg
+ def __init__(self, m
essage
, *detail):
+ super().__init__()
+ self.message = m
essage
self.detail = detail
def handle(self, req):
self.detail = detail
def handle(self, req):
- return
xhtml.forreq(req, skelfor(req).error(self.message, *self.detail)
)
+ return
skelfor(req).error(req, self.message, *self.detail
)
class httperror(usererror):
def __init__(self, status, message = None, detail = None):
class httperror(usererror):
def __init__(self, status, message = None, detail = None):
@@
-50,20
+50,20
@@
class httperror(usererror):
message = proto.statusinfo[status][0]
if detail is None:
detail = (proto.statusinfo[status][1],)
message = proto.statusinfo[status][0]
if detail is None:
detail = (proto.statusinfo[status][1],)
- super(
httperror, self
).__init__(message, *detail)
+ super().__init__(message, *detail)
self.status = status
def handle(self, req):
req.status(self.status, self.message)
self.status = status
def handle(self, req):
req.status(self.status, self.message)
- return super(
httperror, self
).handle(req)
+ return super().handle(req)
class notfound(httperror):
def __init__(self):
class notfound(httperror):
def __init__(self):
- return super(
notfound, self
).__init__(404)
+ return super().__init__(404)
class redirect(dispatch.restart):
def __init__(self, url, status = 303):
class redirect(dispatch.restart):
def __init__(self, url, status = 303):
- super(
redirect, self
).__init__()
+ super().__init__()
self.url = url
self.status = status
self.url = url
self.status = status