@view_config is a @view_config decorator, not a strictly traditional decorator. Until it calls itself .scan() , something takes effect.
It also means that they are not inherited, however venusian provides a class decoder named lift() that will do what you need.
The venusian API documentation shows that in your use case there should be something like the following:
from venusian import lift @view_defaults(route_name='view_a', renderer='templates/views.mak') class View_A(object): def message(self): return 'This is view a' @view_config(request_method='GET') def get(self): return {'message': self.message()} @view_defaults(route_name='view_b') @lift() class View_B(View_A): def message(self): return 'This is view b'
At this point, all of your inherited functions will correctly apply @view_config . Now when you run .scan() your application will behave as expected.
Note that @view_defaults inheritance may change in the future: https://github.com/Pylons/pyramid/issues/1382 .
This may or may not change your views, as indicated, depending on whether you expect the renderer to migrate from the superclass.
source share