[Zope3-dev] Re: HTTP 405: Method Not Allowed
Stephan Richter
srichter at cosmos.phy.tufts.edu
Wed Apr 13 10:47:15 EDT 2005
On Thursday 07 April 2005 16:06, Philipp von Weitershausen wrote:
> > class MethodNotAllowed(Exception):
> > implements(IMethodNotAllowed)
> >
> > def __init__(self, object, request):
> > self.allow = [name for name, adapter
> > in zapi.getAdapters((object, request), Interface)
> > if hasattr(adapter, name)]
> >
> > def __str__(self):
> > return 'Allow: %s' % self.allow
> >
> >
> > class MethodNotAllowedView:
> >
> > def __init__(self, error, request):
> > self.error = error
> > self.request = request
> >
> > def __call__(self):
> > self.request.response.setHeader('Allow', ',
> > '.join(self.error.allow)) self.request.response.setStatus(405)
> > return 'Method Not Allowed'
>
> This looks good. I'm +1 on this.
+1 I think this is a first good step. We have to think about the special cases
a bit harder.
Regards,
Stephan
--
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
More information about the Zope3-dev
mailing list