Dear all,
Some of my resources will have identical views for some request methods
(see below for an example). I would therefore like to be able to inherit
these from a base class. However, the code below does not appear to work
(e.g. POST returns 404 Not Found rather than 405 Method Not Allowed).
Any thoughts on how I could achieve type behaviour?
class _BaseView(object):
@view_config(request_method='OPTIONS')
def options(self):
"Return OPTIONS response."
return Response(allow=['HEAD', 'GET', 'OPTIONS'])
@view_config()
def other_request_methods(self):
"Disallow other request methods."
return HTTPMethodNotAllowed()
@view_defaults(route_name='real_view')
class RealView(_BaseView):
def __init__(self, request):
self.request = request
@view_config(request_method='GET')
def get(self):
return Response('This is a view...')
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.