application: not use config.scan(), and replace all @add_view decorator into a explicit add_view call for faster app start.

This commit is contained in:
Milka Kuzminski 2020-12-08 17:04:39 +01:00
parent 9d122ba26f
commit eb5ec20934
89 changed files with 2537 additions and 1706 deletions

View file

@ -20,8 +20,13 @@
def includeme(config):
from rhodecode.apps.user_group_profile.views import UserGroupProfileView
config.add_route(
name='user_group_profile',
pattern='/_profile_user_group/{user_group_name}')
# Scan module for configuration decorators.
config.scan('.views', ignore='.tests')
config.add_view(
UserGroupProfileView,
attr='user_group_profile',
route_name='user_group_profile', request_method='GET',
renderer='rhodecode:templates/user_group/user_group.mako')

View file

@ -21,7 +21,7 @@
import logging
from pyramid.httpexceptions import HTTPNotFound
from pyramid.view import view_config
from rhodecode.apps._base import BaseAppView
from rhodecode.lib.auth import HasUserGroupPermissionAnyDecorator, LoginRequired, NotAnonymous
@ -36,9 +36,6 @@ class UserGroupProfileView(BaseAppView):
@LoginRequired()
@NotAnonymous()
@HasUserGroupPermissionAnyDecorator('usergroup.read', 'usergroup.write', 'usergroup.admin',)
@view_config(
route_name='user_group_profile', request_method='GET',
renderer='rhodecode:templates/user_group/user_group.mako')
def user_group_profile(self):
c = self._get_local_tmpl_context()
c.active = 'profile'