X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=wrw%2Fresp.py;h=6e95ec56c8f172a6104adf4e39eec2cc58850cb1;hb=3614ca8353a5f2055fdcc086e6bc9dc993b49b42;hp=8216d23502d9386b674bb304e36729442b6cf99a;hpb=4bd573f957065c9a1998b3c7202892319a004c95;p=wrw.git diff --git a/wrw/resp.py b/wrw/resp.py index 8216d23..6e95ec5 100644 --- a/wrw/resp.py +++ b/wrw/resp.py @@ -1,4 +1,4 @@ -import dispatch, proto +from . import dispatch, proto, env __all__ = ["skeleton", "skelfor", "setskel", "usererror"] @@ -27,10 +27,10 @@ class skeleton(object): def message(self, message, detail): return self.page(message, """

%s

\n

%s

\n""" % (message, detail)) -defskel = skeleton() +defskel = env.var(skeleton()) def getskel(req): - return [defskel] + return [defskel.val] def skelfor(req): return req.item(getskel)[0] def setskel(req, skel): @@ -38,7 +38,7 @@ def setskel(req, skel): class usererror(dispatch.restart): def __init__(self, message, detail): - super(usererror, self).__init__() + super().__init__() self.message = message self.detail = detail @@ -47,7 +47,7 @@ class usererror(dispatch.restart): class message(dispatch.restart): def __init__(self, message, detail): - super(message, self).__init__() + super().__init__() self.message = message self.detail = detail @@ -60,20 +60,20 @@ class httperror(usererror): 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) - return super(httperror, self).handle(req) + return super().handle(req) 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): - super(redirect, self).__init__() + super().__init__() self.url = url self.status = status