[Twisted-Python] resource.render_METHOD
Richard.Townsend at edl.uk.eds.com
Richard.Townsend at edl.uk.eds.com
Tue Mar 2 08:57:28 MST 2004
I have a server application that creates a number of web resources (derived
from resource.Resource). Some of the resources only handle GET requests,
while others only handle POSTs.
Currently the resources only override the render() method. I want to change
them to override render_GET() or render_POST() as appropriate.
I notice that if a resource receives a request it doesn't handle, then an
UnsupportedMethod exception is raised. This returns HTML to the client
containing a message that uses UnsupportedMethod.allowedMethods. This
defaults to an empty tuple.
Because my resources support different request methods, I have to set
allowedMethods in each resource's render() method e.g.
def render(self, request):
server.UnsupportedMethod.allowedMethods = ('POST',)
resource.Resource.render(self, request)
So I still need to override the render() method.
Is there a neater way to do this?
I'm using Twisted 1.2.0
regards
Richard Townsend
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20040302/8491b2b4/attachment.htm
More information about the Twisted-Python
mailing list