mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 11:16:24 +00:00
Merge pull request #718 from sajith/3308.remove-web-common-rendermixin
Remove web.common.RenderMixin
This commit is contained in:
commit
a5ea767352
0
newsfragments/3308.minor
Normal file
0
newsfragments/3308.minor
Normal file
@ -365,42 +365,6 @@ class NeedOperationHandleError(WebError):
|
||||
pass
|
||||
|
||||
|
||||
# XXX should be phased out by the nevow -> twisted.web port (that is,
|
||||
# this whole class should have no users and can be deleted once the
|
||||
# port away from nevow is complete)
|
||||
class RenderMixin(object):
|
||||
|
||||
def renderHTTP(self, ctx):
|
||||
request = IRequest(ctx)
|
||||
|
||||
# if we were using regular twisted.web Resources (and the regular
|
||||
# twisted.web.server.Request object) then we could implement
|
||||
# render_PUT and render_GET. But Nevow's request handler
|
||||
# (NevowRequest.gotPageContext) goes directly to renderHTTP. Copy
|
||||
# some code from the Resource.render method that Nevow bypasses, to
|
||||
# do the same thing.
|
||||
m = getattr(self, 'render_' + request.method, None)
|
||||
if not m:
|
||||
raise server.UnsupportedMethod(getattr(self, 'allowedMethods', ()))
|
||||
return m(ctx)
|
||||
|
||||
def render_OPTIONS(self, ctx):
|
||||
"""
|
||||
Handle HTTP OPTIONS request by adding appropriate headers.
|
||||
|
||||
:param ctx: client transaction from which request is extracted
|
||||
:returns: str (empty)
|
||||
"""
|
||||
req = IRequest(ctx)
|
||||
req.setHeader("server", "Tahoe-LAFS gateway")
|
||||
methods = ', '.join([m[7:] for m in dir(self) if m.startswith('render_')])
|
||||
req.setHeader("allow", methods)
|
||||
req.setHeader("public", methods)
|
||||
req.setHeader("compliance", "rfc=2068, rfc=2616")
|
||||
req.setHeader("content-length", 0)
|
||||
return ""
|
||||
|
||||
|
||||
class MultiFormatPage(Page):
|
||||
"""
|
||||
```MultiFormatPage`` is a ``rend.Page`` that can be rendered in a number
|
||||
|
Loading…
Reference in New Issue
Block a user