self.detail = detail
def handle(self, req):
- return skelfor(req).error(req, self.message, *self.detail)
+ return skelfor(req).message(req, self.message, *self.detail)
class httperror(usererror):
def __init__(self, status, message = None, detail = None):
def handle(self, req):
req.status(self.status, "Redirect")
req.ohead["Location"] = proto.appendurl(proto.requrl(req), self.url)
+ req.ohead["Content-Length"] = 0
return []
+
+ class unmodified(dispatch.restart):
+ def handle(self, req):
+ req.status(304, "Not Modified")
+ req.ohead["Content-Length"] = "0"
+ return []
req.ohead["Content-Type"] = "text/html; charset=utf-8"
buf = StringIO.StringIO()
htmlindenter.output(buf, tree, doctype=(doctype, dtd), charset="utf-8")
- return [buf.getvalue()]
+ ret = buf.getvalue()
+ req.ohead["Content-Length"] = len(ret)
+ return [ret]
def xhtmlresp(callable):
def wrapper(req):
return forreq(req, callable(req))
+ wrapper.__wrapped__ = callable
return wrapper