hapic icon indicating copy to clipboard operation
hapic copied to clipboard

Pyramid instance method with @view_config not supported

Open inkhey opened this issue 6 years ago • 0 comments

When using instance method like the fourth example here (https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/viewconfig.html#view-config-placement) with @view_config :

from pyramid.response import Response
from pyramid.view import view_config

class MyView(object):
    def __init__(self, request):
        self.request = request

    @view_config(route_name='hello')
    def amethod(self):
        return Response('hello')

It's not possible to have working @hapic.with_api_doc() at the same time for amethod. That's because find_route method in context for pyramid, try to find the callable of the method, but in this case, the 'callable' is just the class MyView and info about method used is in 'attr' param as str, not as callable objet.

inkhey avatar May 03 '18 13:05 inkhey