# HG changeset patch # User Milka Kuzminski # Date 2020-12-08 16:04:39 # Node ID 1c249462ea55d9749c2c8169094a8d0a4fa23dc5 # Parent a3bacd677d39dcfba3e14ebb528a1f3f418796ca application: not use config.scan(), and replace all @add_view decorator into a explicit add_view call for faster app start. diff --git a/rhodecode/api/__init__.py b/rhodecode/api/__init__.py --- a/rhodecode/api/__init__.py +++ b/rhodecode/api/__init__.py @@ -527,6 +527,14 @@ class jsonrpc_deprecated_method(object): return result +def add_api_methods(config): + from rhodecode.api.views import ( + deprecated_api, gist_api, pull_request_api, repo_api, repo_group_api, + server_api, search_api, testing_api, user_api, user_group_api) + + config.scan('rhodecode.api.views') + + def includeme(config): plugin_module = 'rhodecode.api' plugin_settings = get_plugin_settings( @@ -549,7 +557,8 @@ def includeme(config): config.add_route( 'apiv2', plugin_settings.get('url', DEFAULT_URL), jsonrpc_call=True) - config.scan(plugin_module, ignore='rhodecode.api.tests') # register some exception handling view config.add_view(exception_view, context=JSONRPCBaseError) config.add_notfound_view(exception_view, jsonrpc_method_not_found=True) + + add_api_methods(config) diff --git a/rhodecode/apps/_base/navigation.py b/rhodecode/apps/_base/navigation.py --- a/rhodecode/apps/_base/navigation.py +++ b/rhodecode/apps/_base/navigation.py @@ -144,3 +144,5 @@ def includeme(config): labs_active = str2bool(settings.get('labs_settings_active', False)) navigation_registry_instance = NavigationRegistry(labs_active=labs_active) config.registry.registerUtility(navigation_registry_instance) + log.debug('Created new nabigation instance, %s', navigation_registry_instance) + diff --git a/rhodecode/apps/admin/__init__.py b/rhodecode/apps/admin/__init__.py --- a/rhodecode/apps/admin/__init__.py +++ b/rhodecode/apps/admin/__init__.py @@ -26,441 +26,1030 @@ def admin_routes(config): """ Admin prefixed routes """ + from rhodecode.apps.admin.views.audit_logs import AdminAuditLogsView + from rhodecode.apps.admin.views.defaults import AdminDefaultSettingsView + from rhodecode.apps.admin.views.exception_tracker import ExceptionsTrackerView + from rhodecode.apps.admin.views.main_views import AdminMainView + from rhodecode.apps.admin.views.open_source_licenses import OpenSourceLicensesAdminSettingsView + from rhodecode.apps.admin.views.permissions import AdminPermissionsView + from rhodecode.apps.admin.views.process_management import AdminProcessManagementView + from rhodecode.apps.admin.views.repo_groups import AdminRepoGroupsView + from rhodecode.apps.admin.views.repositories import AdminReposView + from rhodecode.apps.admin.views.sessions import AdminSessionSettingsView + from rhodecode.apps.admin.views.settings import AdminSettingsView + from rhodecode.apps.admin.views.svn_config import AdminSvnConfigView + from rhodecode.apps.admin.views.system_info import AdminSystemInfoSettingsView + from rhodecode.apps.admin.views.user_groups import AdminUserGroupsView + from rhodecode.apps.admin.views.users import AdminUsersView, UsersView + config.add_route( name='admin_audit_logs', pattern='/audit_logs') + config.add_view( + AdminAuditLogsView, + attr='admin_audit_logs', + route_name='admin_audit_logs', request_method='GET', + renderer='rhodecode:templates/admin/admin_audit_logs.mako') config.add_route( name='admin_audit_log_entry', pattern='/audit_logs/{audit_log_id}') - - config.add_route( - name='pull_requests_global_0', # backward compat - pattern='/pull_requests/{pull_request_id:\d+}') - config.add_route( - name='pull_requests_global_1', # backward compat - pattern='/pull-requests/{pull_request_id:\d+}') - config.add_route( - name='pull_requests_global', - pattern='/pull-request/{pull_request_id:\d+}') + config.add_view( + AdminAuditLogsView, + attr='admin_audit_log_entry', + route_name='admin_audit_log_entry', request_method='GET', + renderer='rhodecode:templates/admin/admin_audit_log_entry.mako') config.add_route( name='admin_settings_open_source', pattern='/settings/open_source') + config.add_view( + OpenSourceLicensesAdminSettingsView, + attr='open_source_licenses', + route_name='admin_settings_open_source', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_vcs_svn_generate_cfg', pattern='/settings/vcs/svn_generate_cfg') + config.add_view( + AdminSvnConfigView, + attr='vcs_svn_generate_config', + route_name='admin_settings_vcs_svn_generate_cfg', + request_method='POST', renderer='json') config.add_route( name='admin_settings_system', pattern='/settings/system') + config.add_view( + AdminSystemInfoSettingsView, + attr='settings_system_info', + route_name='admin_settings_system', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_system_update', pattern='/settings/system/updates') + config.add_view( + AdminSystemInfoSettingsView, + attr='settings_system_info_check_update', + route_name='admin_settings_system_update', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings_system_update.mako') config.add_route( name='admin_settings_exception_tracker', pattern='/settings/exceptions') + config.add_view( + ExceptionsTrackerView, + attr='browse_exceptions', + route_name='admin_settings_exception_tracker', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_exception_tracker_delete_all', - pattern='/settings/exceptions/delete') + pattern='/settings/exceptions_delete_all') + config.add_view( + ExceptionsTrackerView, + attr='exception_delete_all', + route_name='admin_settings_exception_tracker_delete_all', request_method='POST', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_exception_tracker_show', pattern='/settings/exceptions/{exception_id}') + config.add_view( + ExceptionsTrackerView, + attr='exception_show', + route_name='admin_settings_exception_tracker_show', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_exception_tracker_delete', pattern='/settings/exceptions/{exception_id}/delete') + config.add_view( + ExceptionsTrackerView, + attr='exception_delete', + route_name='admin_settings_exception_tracker_delete', request_method='POST', + renderer='rhodecode:templates/admin/settings/settings.mako') config.add_route( name='admin_settings_sessions', pattern='/settings/sessions') + config.add_view( + AdminSessionSettingsView, + attr='settings_sessions', + route_name='admin_settings_sessions', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_sessions_cleanup', pattern='/settings/sessions/cleanup') + config.add_view( + AdminSessionSettingsView, + attr='settings_sessions_cleanup', + route_name='admin_settings_sessions_cleanup', request_method='POST') config.add_route( name='admin_settings_process_management', pattern='/settings/process_management') + config.add_view( + AdminProcessManagementView, + attr='process_management', + route_name='admin_settings_process_management', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_process_management_data', pattern='/settings/process_management/data') + config.add_view( + AdminProcessManagementView, + attr='process_management_data', + route_name='admin_settings_process_management_data', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings_process_management_data.mako') + config.add_route( name='admin_settings_process_management_signal', pattern='/settings/process_management/signal') + config.add_view( + AdminProcessManagementView, + attr='process_management_signal', + route_name='admin_settings_process_management_signal', + request_method='POST', renderer='json_ext') + config.add_route( name='admin_settings_process_management_master_signal', pattern='/settings/process_management/master_signal') + config.add_view( + AdminProcessManagementView, + attr='process_management_master_signal', + route_name='admin_settings_process_management_master_signal', + request_method='POST', renderer='json_ext') # default settings config.add_route( name='admin_defaults_repositories', pattern='/defaults/repositories') + config.add_view( + AdminDefaultSettingsView, + attr='defaults_repository_show', + route_name='admin_defaults_repositories', request_method='GET', + renderer='rhodecode:templates/admin/defaults/defaults.mako') + config.add_route( name='admin_defaults_repositories_update', pattern='/defaults/repositories/update') + config.add_view( + AdminDefaultSettingsView, + attr='defaults_repository_update', + route_name='admin_defaults_repositories_update', request_method='POST', + renderer='rhodecode:templates/admin/defaults/defaults.mako') # admin settings config.add_route( name='admin_settings', pattern='/settings') + config.add_view( + AdminSettingsView, + attr='settings_global', + route_name='admin_settings', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_update', pattern='/settings/update') + config.add_view( + AdminSettingsView, + attr='settings_global_update', + route_name='admin_settings_update', request_method='POST', + renderer='rhodecode:templates/admin/settings/settings.mako') config.add_route( name='admin_settings_global', pattern='/settings/global') + config.add_view( + AdminSettingsView, + attr='settings_global', + route_name='admin_settings_global', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_global_update', pattern='/settings/global/update') + config.add_view( + AdminSettingsView, + attr='settings_global_update', + route_name='admin_settings_global_update', request_method='POST', + renderer='rhodecode:templates/admin/settings/settings.mako') config.add_route( name='admin_settings_vcs', pattern='/settings/vcs') + config.add_view( + AdminSettingsView, + attr='settings_vcs', + route_name='admin_settings_vcs', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_vcs_update', pattern='/settings/vcs/update') + config.add_view( + AdminSettingsView, + attr='settings_vcs_update', + route_name='admin_settings_vcs_update', request_method='POST', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_vcs_svn_pattern_delete', pattern='/settings/vcs/svn_pattern_delete') + config.add_view( + AdminSettingsView, + attr='settings_vcs_delete_svn_pattern', + route_name='admin_settings_vcs_svn_pattern_delete', request_method='POST', + renderer='json_ext', xhr=True) config.add_route( name='admin_settings_mapping', pattern='/settings/mapping') + config.add_view( + AdminSettingsView, + attr='settings_mapping', + route_name='admin_settings_mapping', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_mapping_update', pattern='/settings/mapping/update') + config.add_view( + AdminSettingsView, + attr='settings_mapping_update', + route_name='admin_settings_mapping_update', request_method='POST', + renderer='rhodecode:templates/admin/settings/settings.mako') config.add_route( name='admin_settings_visual', pattern='/settings/visual') + config.add_view( + AdminSettingsView, + attr='settings_visual', + route_name='admin_settings_visual', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_visual_update', pattern='/settings/visual/update') + config.add_view( + AdminSettingsView, + attr='settings_visual_update', + route_name='admin_settings_visual_update', request_method='POST', + renderer='rhodecode:templates/admin/settings/settings.mako') config.add_route( name='admin_settings_issuetracker', pattern='/settings/issue-tracker') + config.add_view( + AdminSettingsView, + attr='settings_issuetracker', + route_name='admin_settings_issuetracker', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_issuetracker_update', pattern='/settings/issue-tracker/update') + config.add_view( + AdminSettingsView, + attr='settings_issuetracker_update', + route_name='admin_settings_issuetracker_update', request_method='POST', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_issuetracker_test', pattern='/settings/issue-tracker/test') + config.add_view( + AdminSettingsView, + attr='settings_issuetracker_test', + route_name='admin_settings_issuetracker_test', request_method='POST', + renderer='string', xhr=True) + config.add_route( name='admin_settings_issuetracker_delete', pattern='/settings/issue-tracker/delete') + config.add_view( + AdminSettingsView, + attr='settings_issuetracker_delete', + route_name='admin_settings_issuetracker_delete', request_method='POST', + renderer='json_ext', xhr=True) config.add_route( name='admin_settings_email', pattern='/settings/email') + config.add_view( + AdminSettingsView, + attr='settings_email', + route_name='admin_settings_email', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_email_update', pattern='/settings/email/update') + config.add_view( + AdminSettingsView, + attr='settings_email_update', + route_name='admin_settings_email_update', request_method='POST', + renderer='rhodecode:templates/admin/settings/settings.mako') config.add_route( name='admin_settings_hooks', pattern='/settings/hooks') + config.add_view( + AdminSettingsView, + attr='settings_hooks', + route_name='admin_settings_hooks', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_hooks_update', pattern='/settings/hooks/update') + config.add_view( + AdminSettingsView, + attr='settings_hooks_update', + route_name='admin_settings_hooks_update', request_method='POST', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_hooks_delete', pattern='/settings/hooks/delete') + config.add_view( + AdminSettingsView, + attr='settings_hooks_update', + route_name='admin_settings_hooks_delete', request_method='POST', + renderer='rhodecode:templates/admin/settings/settings.mako') config.add_route( name='admin_settings_search', pattern='/settings/search') + config.add_view( + AdminSettingsView, + attr='settings_search', + route_name='admin_settings_search', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings.mako') config.add_route( name='admin_settings_labs', pattern='/settings/labs') + config.add_view( + AdminSettingsView, + attr='settings_labs', + route_name='admin_settings_labs', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings.mako') + config.add_route( name='admin_settings_labs_update', pattern='/settings/labs/update') + config.add_view( + AdminSettingsView, + attr='settings_labs_update', + route_name='admin_settings_labs_update', request_method='POST', + renderer='rhodecode:templates/admin/settings/settings.mako') # Automation EE feature config.add_route( 'admin_settings_automation', pattern=ADMIN_PREFIX + '/settings/automation') + config.add_view( + AdminSettingsView, + attr='settings_automation', + route_name='admin_settings_automation', request_method='GET', + renderer='rhodecode:templates/admin/settings/settings.mako') # global permissions config.add_route( name='admin_permissions_application', pattern='/permissions/application') + config.add_view( + AdminPermissionsView, + attr='permissions_application', + route_name='admin_permissions_application', request_method='GET', + renderer='rhodecode:templates/admin/permissions/permissions.mako') + config.add_route( name='admin_permissions_application_update', pattern='/permissions/application/update') + config.add_view( + AdminPermissionsView, + attr='permissions_application_update', + route_name='admin_permissions_application_update', request_method='POST', + renderer='rhodecode:templates/admin/permissions/permissions.mako') config.add_route( name='admin_permissions_global', pattern='/permissions/global') + config.add_view( + AdminPermissionsView, + attr='permissions_global', + route_name='admin_permissions_global', request_method='GET', + renderer='rhodecode:templates/admin/permissions/permissions.mako') + config.add_route( name='admin_permissions_global_update', pattern='/permissions/global/update') + config.add_view( + AdminPermissionsView, + attr='permissions_global_update', + route_name='admin_permissions_global_update', request_method='POST', + renderer='rhodecode:templates/admin/permissions/permissions.mako') config.add_route( name='admin_permissions_object', pattern='/permissions/object') + config.add_view( + AdminPermissionsView, + attr='permissions_objects', + route_name='admin_permissions_object', request_method='GET', + renderer='rhodecode:templates/admin/permissions/permissions.mako') + config.add_route( name='admin_permissions_object_update', pattern='/permissions/object/update') + config.add_view( + AdminPermissionsView, + attr='permissions_objects_update', + route_name='admin_permissions_object_update', request_method='POST', + renderer='rhodecode:templates/admin/permissions/permissions.mako') # Branch perms EE feature config.add_route( name='admin_permissions_branch', pattern='/permissions/branch') + config.add_view( + AdminPermissionsView, + attr='permissions_branch', + route_name='admin_permissions_branch', request_method='GET', + renderer='rhodecode:templates/admin/permissions/permissions.mako') config.add_route( name='admin_permissions_ips', pattern='/permissions/ips') + config.add_view( + AdminPermissionsView, + attr='permissions_ips', + route_name='admin_permissions_ips', request_method='GET', + renderer='rhodecode:templates/admin/permissions/permissions.mako') config.add_route( name='admin_permissions_overview', pattern='/permissions/overview') + config.add_view( + AdminPermissionsView, + attr='permissions_overview', + route_name='admin_permissions_overview', request_method='GET', + renderer='rhodecode:templates/admin/permissions/permissions.mako') config.add_route( name='admin_permissions_auth_token_access', pattern='/permissions/auth_token_access') + config.add_view( + AdminPermissionsView, + attr='auth_token_access', + route_name='admin_permissions_auth_token_access', request_method='GET', + renderer='rhodecode:templates/admin/permissions/permissions.mako') config.add_route( name='admin_permissions_ssh_keys', pattern='/permissions/ssh_keys') + config.add_view( + AdminPermissionsView, + attr='ssh_keys', + route_name='admin_permissions_ssh_keys', request_method='GET', + renderer='rhodecode:templates/admin/permissions/permissions.mako') + config.add_route( name='admin_permissions_ssh_keys_data', pattern='/permissions/ssh_keys/data') + config.add_view( + AdminPermissionsView, + attr='ssh_keys_data', + route_name='admin_permissions_ssh_keys_data', request_method='GET', + renderer='json_ext', xhr=True) + config.add_route( name='admin_permissions_ssh_keys_update', pattern='/permissions/ssh_keys/update') + config.add_view( + AdminPermissionsView, + attr='ssh_keys_update', + route_name='admin_permissions_ssh_keys_update', request_method='POST', + renderer='rhodecode:templates/admin/permissions/permissions.mako') # users admin config.add_route( name='users', pattern='/users') + config.add_view( + AdminUsersView, + attr='users_list', + route_name='users', request_method='GET', + renderer='rhodecode:templates/admin/users/users.mako') config.add_route( name='users_data', pattern='/users_data') + config.add_view( + AdminUsersView, + attr='users_list_data', + # renderer defined below + route_name='users_data', request_method='GET', + renderer='json_ext', xhr=True) config.add_route( name='users_create', pattern='/users/create') + config.add_view( + AdminUsersView, + attr='users_create', + route_name='users_create', request_method='POST', + renderer='rhodecode:templates/admin/users/user_add.mako') config.add_route( name='users_new', pattern='/users/new') + config.add_view( + AdminUsersView, + attr='users_new', + route_name='users_new', request_method='GET', + renderer='rhodecode:templates/admin/users/user_add.mako') # user management config.add_route( name='user_edit', pattern='/users/{user_id:\d+}/edit', user_route=True) + config.add_view( + UsersView, + attr='user_edit', + route_name='user_edit', request_method='GET', + renderer='rhodecode:templates/admin/users/user_edit.mako') + config.add_route( name='user_edit_advanced', pattern='/users/{user_id:\d+}/edit/advanced', user_route=True) + config.add_view( + UsersView, + attr='user_edit_advanced', + route_name='user_edit_advanced', request_method='GET', + renderer='rhodecode:templates/admin/users/user_edit.mako') + config.add_route( name='user_edit_global_perms', pattern='/users/{user_id:\d+}/edit/global_permissions', user_route=True) + config.add_view( + UsersView, + attr='user_edit_global_perms', + route_name='user_edit_global_perms', request_method='GET', + renderer='rhodecode:templates/admin/users/user_edit.mako') + config.add_route( name='user_edit_global_perms_update', pattern='/users/{user_id:\d+}/edit/global_permissions/update', user_route=True) + config.add_view( + UsersView, + attr='user_edit_global_perms_update', + route_name='user_edit_global_perms_update', request_method='POST', + renderer='rhodecode:templates/admin/users/user_edit.mako') + config.add_route( name='user_update', pattern='/users/{user_id:\d+}/update', user_route=True) + config.add_view( + UsersView, + attr='user_update', + route_name='user_update', request_method='POST', + renderer='rhodecode:templates/admin/users/user_edit.mako') + config.add_route( name='user_delete', pattern='/users/{user_id:\d+}/delete', user_route=True) + config.add_view( + UsersView, + attr='user_delete', + route_name='user_delete', request_method='POST', + renderer='rhodecode:templates/admin/users/user_edit.mako') + config.add_route( name='user_enable_force_password_reset', pattern='/users/{user_id:\d+}/password_reset_enable', user_route=True) + config.add_view( + UsersView, + attr='user_enable_force_password_reset', + route_name='user_enable_force_password_reset', request_method='POST', + renderer='rhodecode:templates/admin/users/user_edit.mako') + config.add_route( name='user_disable_force_password_reset', pattern='/users/{user_id:\d+}/password_reset_disable', user_route=True) + config.add_view( + UsersView, + attr='user_disable_force_password_reset', + route_name='user_disable_force_password_reset', request_method='POST', + renderer='rhodecode:templates/admin/users/user_edit.mako') + config.add_route( name='user_create_personal_repo_group', pattern='/users/{user_id:\d+}/create_repo_group', user_route=True) + config.add_view( + UsersView, + attr='user_create_personal_repo_group', + route_name='user_create_personal_repo_group', request_method='POST', + renderer='rhodecode:templates/admin/users/user_edit.mako') # user notice config.add_route( name='user_notice_dismiss', pattern='/users/{user_id:\d+}/notice_dismiss', user_route=True) + config.add_view( + UsersView, + attr='user_notice_dismiss', + route_name='user_notice_dismiss', request_method='POST', + renderer='json_ext', xhr=True) # user auth tokens config.add_route( name='edit_user_auth_tokens', pattern='/users/{user_id:\d+}/edit/auth_tokens', user_route=True) + config.add_view( + UsersView, + attr='auth_tokens', + route_name='edit_user_auth_tokens', request_method='GET', + renderer='rhodecode:templates/admin/users/user_edit.mako') + config.add_route( name='edit_user_auth_tokens_view', pattern='/users/{user_id:\d+}/edit/auth_tokens/view', user_route=True) + config.add_view( + UsersView, + attr='auth_tokens_view', + route_name='edit_user_auth_tokens_view', request_method='POST', + renderer='json_ext', xhr=True) + config.add_route( name='edit_user_auth_tokens_add', pattern='/users/{user_id:\d+}/edit/auth_tokens/new', user_route=True) + config.add_view( + UsersView, + attr='auth_tokens_add', + route_name='edit_user_auth_tokens_add', request_method='POST') + config.add_route( name='edit_user_auth_tokens_delete', pattern='/users/{user_id:\d+}/edit/auth_tokens/delete', user_route=True) + config.add_view( + UsersView, + attr='auth_tokens_delete', + route_name='edit_user_auth_tokens_delete', request_method='POST') # user ssh keys config.add_route( name='edit_user_ssh_keys', pattern='/users/{user_id:\d+}/edit/ssh_keys', user_route=True) + config.add_view( + UsersView, + attr='ssh_keys', + route_name='edit_user_ssh_keys', request_method='GET', + renderer='rhodecode:templates/admin/users/user_edit.mako') + config.add_route( name='edit_user_ssh_keys_generate_keypair', pattern='/users/{user_id:\d+}/edit/ssh_keys/generate', user_route=True) + config.add_view( + UsersView, + attr='ssh_keys_generate_keypair', + route_name='edit_user_ssh_keys_generate_keypair', request_method='GET', + renderer='rhodecode:templates/admin/users/user_edit.mako') + config.add_route( name='edit_user_ssh_keys_add', pattern='/users/{user_id:\d+}/edit/ssh_keys/new', user_route=True) + config.add_view( + UsersView, + attr='ssh_keys_add', + route_name='edit_user_ssh_keys_add', request_method='POST') + config.add_route( name='edit_user_ssh_keys_delete', pattern='/users/{user_id:\d+}/edit/ssh_keys/delete', user_route=True) + config.add_view( + UsersView, + attr='ssh_keys_delete', + route_name='edit_user_ssh_keys_delete', request_method='POST') # user emails config.add_route( name='edit_user_emails', pattern='/users/{user_id:\d+}/edit/emails', user_route=True) + config.add_view( + UsersView, + attr='emails', + route_name='edit_user_emails', request_method='GET', + renderer='rhodecode:templates/admin/users/user_edit.mako') + config.add_route( name='edit_user_emails_add', pattern='/users/{user_id:\d+}/edit/emails/new', user_route=True) + config.add_view( + UsersView, + attr='emails_add', + route_name='edit_user_emails_add', request_method='POST') + config.add_route( name='edit_user_emails_delete', pattern='/users/{user_id:\d+}/edit/emails/delete', user_route=True) + config.add_view( + UsersView, + attr='emails_delete', + route_name='edit_user_emails_delete', request_method='POST') # user IPs config.add_route( name='edit_user_ips', pattern='/users/{user_id:\d+}/edit/ips', user_route=True) + config.add_view( + UsersView, + attr='ips', + route_name='edit_user_ips', request_method='GET', + renderer='rhodecode:templates/admin/users/user_edit.mako') + config.add_route( name='edit_user_ips_add', pattern='/users/{user_id:\d+}/edit/ips/new', user_route_with_default=True) # enabled for default user too + config.add_view( + UsersView, + attr='ips_add', + route_name='edit_user_ips_add', request_method='POST') + config.add_route( name='edit_user_ips_delete', pattern='/users/{user_id:\d+}/edit/ips/delete', user_route_with_default=True) # enabled for default user too + config.add_view( + UsersView, + attr='ips_delete', + route_name='edit_user_ips_delete', request_method='POST') # user perms config.add_route( name='edit_user_perms_summary', pattern='/users/{user_id:\d+}/edit/permissions_summary', user_route=True) + config.add_view( + UsersView, + attr='user_perms_summary', + route_name='edit_user_perms_summary', request_method='GET', + renderer='rhodecode:templates/admin/users/user_edit.mako') + config.add_route( name='edit_user_perms_summary_json', pattern='/users/{user_id:\d+}/edit/permissions_summary/json', user_route=True) + config.add_view( + UsersView, + attr='user_perms_summary_json', + route_name='edit_user_perms_summary_json', request_method='GET', + renderer='json_ext') # user user groups management config.add_route( name='edit_user_groups_management', pattern='/users/{user_id:\d+}/edit/groups_management', user_route=True) + config.add_view( + UsersView, + attr='groups_management', + route_name='edit_user_groups_management', request_method='GET', + renderer='rhodecode:templates/admin/users/user_edit.mako') config.add_route( name='edit_user_groups_management_updates', pattern='/users/{user_id:\d+}/edit/edit_user_groups_management/updates', user_route=True) + config.add_view( + UsersView, + attr='groups_management_updates', + route_name='edit_user_groups_management_updates', request_method='POST') # user audit logs config.add_route( name='edit_user_audit_logs', pattern='/users/{user_id:\d+}/edit/audit', user_route=True) + config.add_view( + UsersView, + attr='user_audit_logs', + route_name='edit_user_audit_logs', request_method='GET', + renderer='rhodecode:templates/admin/users/user_edit.mako') config.add_route( name='edit_user_audit_logs_download', pattern='/users/{user_id:\d+}/edit/audit/download', user_route=True) + config.add_view( + UsersView, + attr='user_audit_logs_download', + route_name='edit_user_audit_logs_download', request_method='GET', + renderer='string') # user caches config.add_route( name='edit_user_caches', pattern='/users/{user_id:\d+}/edit/caches', user_route=True) + config.add_view( + UsersView, + attr='user_caches', + route_name='edit_user_caches', request_method='GET', + renderer='rhodecode:templates/admin/users/user_edit.mako') + config.add_route( name='edit_user_caches_update', pattern='/users/{user_id:\d+}/edit/caches/update', user_route=True) + config.add_view( + UsersView, + attr='user_caches_update', + route_name='edit_user_caches_update', request_method='POST') # user-groups admin config.add_route( name='user_groups', pattern='/user_groups') + config.add_view( + AdminUserGroupsView, + attr='user_groups_list', + route_name='user_groups', request_method='GET', + renderer='rhodecode:templates/admin/user_groups/user_groups.mako') config.add_route( name='user_groups_data', pattern='/user_groups_data') + config.add_view( + AdminUserGroupsView, + attr='user_groups_list_data', + route_name='user_groups_data', request_method='GET', + renderer='json_ext', xhr=True) config.add_route( name='user_groups_new', pattern='/user_groups/new') + config.add_view( + AdminUserGroupsView, + attr='user_groups_new', + route_name='user_groups_new', request_method='GET', + renderer='rhodecode:templates/admin/user_groups/user_group_add.mako') config.add_route( name='user_groups_create', pattern='/user_groups/create') + config.add_view( + AdminUserGroupsView, + attr='user_groups_create', + route_name='user_groups_create', request_method='POST', + renderer='rhodecode:templates/admin/user_groups/user_group_add.mako') # repos admin config.add_route( name='repos', pattern='/repos') + config.add_view( + AdminReposView, + attr='repository_list', + route_name='repos', request_method='GET', + renderer='rhodecode:templates/admin/repos/repos.mako') config.add_route( name='repos_data', pattern='/repos_data') + config.add_view( + AdminReposView, + attr='repository_list_data', + route_name='repos_data', request_method='GET', + renderer='json_ext', xhr=True) config.add_route( name='repo_new', pattern='/repos/new') + config.add_view( + AdminReposView, + attr='repository_new', + route_name='repo_new', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_add.mako') config.add_route( name='repo_create', pattern='/repos/create') + config.add_view( + AdminReposView, + attr='repository_create', + route_name='repo_create', request_method='POST', + renderer='rhodecode:templates/admin/repos/repos.mako') # repo groups admin config.add_route( name='repo_groups', pattern='/repo_groups') + config.add_view( + AdminRepoGroupsView, + attr='repo_group_list', + route_name='repo_groups', request_method='GET', + renderer='rhodecode:templates/admin/repo_groups/repo_groups.mako') config.add_route( name='repo_groups_data', pattern='/repo_groups_data') + config.add_view( + AdminRepoGroupsView, + attr='repo_group_list_data', + route_name='repo_groups_data', request_method='GET', + renderer='json_ext', xhr=True) config.add_route( name='repo_group_new', pattern='/repo_group/new') + config.add_view( + AdminRepoGroupsView, + attr='repo_group_new', + route_name='repo_group_new', request_method='GET', + renderer='rhodecode:templates/admin/repo_groups/repo_group_add.mako') config.add_route( name='repo_group_create', pattern='/repo_group/create') + config.add_view( + AdminRepoGroupsView, + attr='repo_group_create', + route_name='repo_group_create', request_method='POST', + renderer='rhodecode:templates/admin/repo_groups/repo_group_add.mako') def includeme(config): from rhodecode.apps._base.navigation import includeme as nav_includeme + from rhodecode.apps.admin.views.main_views import AdminMainView # Create admin navigation registry and add it to the pyramid registry. nav_includeme(config) # main admin routes - config.add_route(name='admin_home', pattern=ADMIN_PREFIX) - config.include(admin_routes, route_prefix=ADMIN_PREFIX) + config.add_route( + name='admin_home', pattern=ADMIN_PREFIX) + config.add_view( + AdminMainView, + attr='admin_main', + route_name='admin_home', request_method='GET', + renderer='rhodecode:templates/admin/main.mako') + + # pr global redirect + config.add_route( + name='pull_requests_global_0', # backward compat + pattern=ADMIN_PREFIX + '/pull_requests/{pull_request_id:\d+}') + config.add_view( + AdminMainView, + attr='pull_requests', + route_name='pull_requests_global_0', request_method='GET') - # Scan module for configuration decorators. - config.scan('.views', ignore='.tests') + config.add_route( + name='pull_requests_global_1', # backward compat + pattern=ADMIN_PREFIX + '/pull-requests/{pull_request_id:\d+}') + config.add_view( + AdminMainView, + attr='pull_requests', + route_name='pull_requests_global_1', request_method='GET') + + config.add_route( + name='pull_requests_global', + pattern=ADMIN_PREFIX + '/pull-request/{pull_request_id:\d+}') + config.add_view( + AdminMainView, + attr='pull_requests', + route_name='pull_requests_global', request_method='GET') + + config.include(admin_routes, route_prefix=ADMIN_PREFIX) diff --git a/rhodecode/apps/admin/views/audit_logs.py b/rhodecode/apps/admin/views/audit_logs.py --- a/rhodecode/apps/admin/views/audit_logs.py +++ b/rhodecode/apps/admin/views/audit_logs.py @@ -21,7 +21,6 @@ import logging from pyramid.httpexceptions import HTTPNotFound -from pyramid.view import view_config from rhodecode.apps._base import BaseAppView from rhodecode.model.db import joinedload, UserLog @@ -34,15 +33,13 @@ log = logging.getLogger(__name__) class AdminAuditLogsView(BaseAppView): + def load_default_context(self): c = self._get_local_tmpl_context() return c @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_audit_logs', request_method='GET', - renderer='rhodecode:templates/admin/admin_audit_logs.mako') def admin_audit_logs(self): c = self.load_default_context() @@ -76,9 +73,6 @@ class AdminAuditLogsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_audit_log_entry', request_method='GET', - renderer='rhodecode:templates/admin/admin_audit_log_entry.mako') def admin_audit_log_entry(self): c = self.load_default_context() audit_log_id = self.request.matchdict['audit_log_id'] diff --git a/rhodecode/apps/admin/views/defaults.py b/rhodecode/apps/admin/views/defaults.py --- a/rhodecode/apps/admin/views/defaults.py +++ b/rhodecode/apps/admin/views/defaults.py @@ -23,7 +23,6 @@ import logging import formencode import formencode.htmlfill -from pyramid.view import view_config from pyramid.httpexceptions import HTTPFound from pyramid.renderers import render from pyramid.response import Response @@ -41,17 +40,13 @@ log = logging.getLogger(__name__) class AdminDefaultSettingsView(BaseAppView): + def load_default_context(self): c = self._get_local_tmpl_context() - - return c @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_defaults_repositories', request_method='GET', - renderer='rhodecode:templates/admin/defaults/defaults.mako') def defaults_repository_show(self): c = self.load_default_context() c.backends = BACKENDS.keys() @@ -72,9 +67,6 @@ class AdminDefaultSettingsView(BaseAppVi @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_defaults_repositories_update', request_method='POST', - renderer='rhodecode:templates/admin/defaults/defaults.mako') def defaults_repository_update(self): _ = self.request.translate c = self.load_default_context() diff --git a/rhodecode/apps/admin/views/exception_tracker.py b/rhodecode/apps/admin/views/exception_tracker.py --- a/rhodecode/apps/admin/views/exception_tracker.py +++ b/rhodecode/apps/admin/views/exception_tracker.py @@ -21,7 +21,6 @@ import os import logging from pyramid.httpexceptions import HTTPFound -from pyramid.view import view_config from rhodecode.apps._base import BaseAppView from rhodecode.apps._base.navigation import navigation_list @@ -99,9 +98,6 @@ class ExceptionsTrackerView(BaseAppView) @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings_exception_tracker', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings.mako') def browse_exceptions(self): _ = self.request.translate c = self.load_default_context() @@ -117,9 +113,6 @@ class ExceptionsTrackerView(BaseAppView) @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings_exception_tracker_show', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings.mako') def exception_show(self): _ = self.request.translate c = self.load_default_context() @@ -132,9 +125,6 @@ class ExceptionsTrackerView(BaseAppView) @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_settings_exception_tracker_delete_all', request_method='POST', - renderer='rhodecode:templates/admin/settings/settings.mako') def exception_delete_all(self): _ = self.request.translate c = self.load_default_context() @@ -159,9 +149,6 @@ class ExceptionsTrackerView(BaseAppView) @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_settings_exception_tracker_delete', request_method='POST', - renderer='rhodecode:templates/admin/settings/settings.mako') def exception_delete(self): _ = self.request.translate c = self.load_default_context() diff --git a/rhodecode/apps/admin/views/main_views.py b/rhodecode/apps/admin/views/main_views.py --- a/rhodecode/apps/admin/views/main_views.py +++ b/rhodecode/apps/admin/views/main_views.py @@ -21,7 +21,6 @@ import logging from pyramid.httpexceptions import HTTPFound, HTTPNotFound -from pyramid.view import view_config from rhodecode.apps._base import BaseAppView from rhodecode.lib import helpers as h @@ -39,9 +38,6 @@ class AdminMainView(BaseAppView): @LoginRequired() @NotAnonymous() - @view_config( - route_name='admin_home', request_method='GET', - renderer='rhodecode:templates/admin/main.mako') def admin_main(self): c = self.load_default_context() c.active = 'admin' @@ -52,9 +48,6 @@ class AdminMainView(BaseAppView): return self._get_template_context(c) @LoginRequired() - @view_config(route_name='pull_requests_global_0', request_method='GET') - @view_config(route_name='pull_requests_global_1', request_method='GET') - @view_config(route_name='pull_requests_global', request_method='GET') def pull_requests(self): """ Global redirect for Pull Requests diff --git a/rhodecode/apps/admin/views/open_source_licenses.py b/rhodecode/apps/admin/views/open_source_licenses.py --- a/rhodecode/apps/admin/views/open_source_licenses.py +++ b/rhodecode/apps/admin/views/open_source_licenses.py @@ -21,8 +21,6 @@ import collections import logging -from pyramid.view import view_config - from rhodecode.apps._base import BaseAppView from rhodecode.apps._base.navigation import navigation_list from rhodecode.lib.auth import (LoginRequired, HasPermissionAllDecorator) @@ -39,9 +37,6 @@ class OpenSourceLicensesAdminSettingsVie @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings_open_source', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings.mako') def open_source_licenses(self): c = self.load_default_context() c.active = 'open_source' diff --git a/rhodecode/apps/admin/views/permissions.py b/rhodecode/apps/admin/views/permissions.py --- a/rhodecode/apps/admin/views/permissions.py +++ b/rhodecode/apps/admin/views/permissions.py @@ -25,7 +25,6 @@ import formencode.htmlfill import datetime from pyramid.interfaces import IRoutesMapper -from pyramid.view import view_config from pyramid.httpexceptions import HTTPFound from pyramid.renderers import render from pyramid.response import Response @@ -59,9 +58,6 @@ class AdminPermissionsView(BaseAppView, @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_permissions_application', request_method='GET', - renderer='rhodecode:templates/admin/permissions/permissions.mako') def permissions_application(self): c = self.load_default_context() c.active = 'application' @@ -90,9 +86,6 @@ class AdminPermissionsView(BaseAppView, @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_permissions_application_update', request_method='POST', - renderer='rhodecode:templates/admin/permissions/permissions.mako') def permissions_application_update(self): _ = self.request.translate c = self.load_default_context() @@ -149,9 +142,6 @@ class AdminPermissionsView(BaseAppView, @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_permissions_object', request_method='GET', - renderer='rhodecode:templates/admin/permissions/permissions.mako') def permissions_objects(self): c = self.load_default_context() c.active = 'objects' @@ -174,9 +164,6 @@ class AdminPermissionsView(BaseAppView, @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_permissions_object_update', request_method='POST', - renderer='rhodecode:templates/admin/permissions/permissions.mako') def permissions_objects_update(self): _ = self.request.translate c = self.load_default_context() @@ -225,9 +212,6 @@ class AdminPermissionsView(BaseAppView, @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_permissions_branch', request_method='GET', - renderer='rhodecode:templates/admin/permissions/permissions.mako') def permissions_branch(self): c = self.load_default_context() c.active = 'branch' @@ -249,9 +233,6 @@ class AdminPermissionsView(BaseAppView, @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_permissions_global', request_method='GET', - renderer='rhodecode:templates/admin/permissions/permissions.mako') def permissions_global(self): c = self.load_default_context() c.active = 'global' @@ -274,9 +255,6 @@ class AdminPermissionsView(BaseAppView, @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_permissions_global_update', request_method='POST', - renderer='rhodecode:templates/admin/permissions/permissions.mako') def permissions_global_update(self): _ = self.request.translate c = self.load_default_context() @@ -327,9 +305,6 @@ class AdminPermissionsView(BaseAppView, @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_permissions_ips', request_method='GET', - renderer='rhodecode:templates/admin/permissions/permissions.mako') def permissions_ips(self): c = self.load_default_context() c.active = 'ips' @@ -342,9 +317,6 @@ class AdminPermissionsView(BaseAppView, @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_permissions_overview', request_method='GET', - renderer='rhodecode:templates/admin/permissions/permissions.mako') def permissions_overview(self): c = self.load_default_context() c.active = 'perms' @@ -355,9 +327,6 @@ class AdminPermissionsView(BaseAppView, @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_permissions_auth_token_access', request_method='GET', - renderer='rhodecode:templates/admin/permissions/permissions.mako') def auth_token_access(self): from rhodecode import CONFIG @@ -415,9 +384,6 @@ class AdminPermissionsView(BaseAppView, @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_permissions_ssh_keys', request_method='GET', - renderer='rhodecode:templates/admin/permissions/permissions.mako') def ssh_keys(self): c = self.load_default_context() c.active = 'ssh_keys' @@ -426,9 +392,6 @@ class AdminPermissionsView(BaseAppView, @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_permissions_ssh_keys_data', request_method='GET', - renderer='json_ext', xhr=True) def ssh_keys_data(self): _ = self.request.translate self.load_default_context() @@ -498,9 +461,6 @@ class AdminPermissionsView(BaseAppView, @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_permissions_ssh_keys_update', request_method='POST', - renderer='rhodecode:templates/admin/permissions/permissions.mako') def ssh_keys_update(self): _ = self.request.translate self.load_default_context() diff --git a/rhodecode/apps/admin/views/process_management.py b/rhodecode/apps/admin/views/process_management.py --- a/rhodecode/apps/admin/views/process_management.py +++ b/rhodecode/apps/admin/views/process_management.py @@ -22,7 +22,7 @@ import logging import psutil import signal -from pyramid.view import view_config + from rhodecode.apps._base import BaseAppView from rhodecode.apps._base.navigation import navigation_list @@ -84,9 +84,6 @@ class AdminProcessManagementView(BaseApp @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings_process_management', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings.mako') def process_management(self): _ = self.request.translate c = self.load_default_context() @@ -99,9 +96,6 @@ class AdminProcessManagementView(BaseApp @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings_process_management_data', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings_process_management_data.mako') def process_management_data(self): _ = self.request.translate c = self.load_default_context() @@ -111,9 +105,6 @@ class AdminProcessManagementView(BaseApp @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_settings_process_management_signal', - request_method='POST', renderer='json_ext') def process_management_signal(self): pids = self.request.json.get('pids', []) result = [] @@ -155,9 +146,6 @@ class AdminProcessManagementView(BaseApp @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_settings_process_management_master_signal', - request_method='POST', renderer='json_ext') def process_management_master_signal(self): pid_data = self.request.json.get('pid_data', {}) pid = safe_int(pid_data['pid']) diff --git a/rhodecode/apps/admin/views/repo_groups.py b/rhodecode/apps/admin/views/repo_groups.py --- a/rhodecode/apps/admin/views/repo_groups.py +++ b/rhodecode/apps/admin/views/repo_groups.py @@ -25,7 +25,7 @@ import formencode import formencode.htmlfill from pyramid.httpexceptions import HTTPFound, HTTPForbidden -from pyramid.view import view_config + from pyramid.renderers import render from pyramid.response import Response @@ -96,9 +96,6 @@ class AdminRepoGroupsView(BaseAppView, D # `repo_group_list_data` via RepoGroupList @LoginRequired() @NotAnonymous() - @view_config( - route_name='repo_groups', request_method='GET', - renderer='rhodecode:templates/admin/repo_groups/repo_groups.mako') def repo_group_list(self): c = self.load_default_context() return self._get_template_context(c) @@ -106,9 +103,6 @@ class AdminRepoGroupsView(BaseAppView, D # permission check inside @LoginRequired() @NotAnonymous() - @view_config( - route_name='repo_groups_data', request_method='GET', - renderer='json_ext', xhr=True) def repo_group_list_data(self): self.load_default_context() column_map = { @@ -254,9 +248,6 @@ class AdminRepoGroupsView(BaseAppView, D @LoginRequired() @NotAnonymous() # perm checks inside - @view_config( - route_name='repo_group_new', request_method='GET', - renderer='rhodecode:templates/admin/repo_groups/repo_group_add.mako') def repo_group_new(self): c = self.load_default_context() @@ -296,9 +287,6 @@ class AdminRepoGroupsView(BaseAppView, D @NotAnonymous() @CSRFRequired() # perm checks inside - @view_config( - route_name='repo_group_create', request_method='POST', - renderer='rhodecode:templates/admin/repo_groups/repo_group_add.mako') def repo_group_create(self): c = self.load_default_context() _ = self.request.translate diff --git a/rhodecode/apps/admin/views/repositories.py b/rhodecode/apps/admin/views/repositories.py --- a/rhodecode/apps/admin/views/repositories.py +++ b/rhodecode/apps/admin/views/repositories.py @@ -23,7 +23,7 @@ import formencode import formencode.htmlfill from pyramid.httpexceptions import HTTPFound, HTTPForbidden -from pyramid.view import view_config + from pyramid.renderers import render from pyramid.response import Response @@ -52,7 +52,6 @@ class AdminReposView(BaseAppView, DataGr def load_default_context(self): c = self._get_local_tmpl_context() - return c def _load_form_data(self, c): @@ -65,9 +64,6 @@ class AdminReposView(BaseAppView, DataGr @LoginRequired() @NotAnonymous() # perms check inside - @view_config( - route_name='repos', request_method='GET', - renderer='rhodecode:templates/admin/repos/repos.mako') def repository_list(self): c = self.load_default_context() return self._get_template_context(c) @@ -75,9 +71,6 @@ class AdminReposView(BaseAppView, DataGr @LoginRequired() @NotAnonymous() # perms check inside - @view_config( - route_name='repos_data', request_method='GET', - renderer='json_ext', xhr=True) def repository_list_data(self): self.load_default_context() column_map = { @@ -162,9 +155,6 @@ class AdminReposView(BaseAppView, DataGr @LoginRequired() @NotAnonymous() # perms check inside - @view_config( - route_name='repo_new', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_add.mako') def repository_new(self): c = self.load_default_context() @@ -216,9 +206,6 @@ class AdminReposView(BaseAppView, DataGr @NotAnonymous() @CSRFRequired() # perms check inside - @view_config( - route_name='repo_create', request_method='POST', - renderer='rhodecode:templates/admin/repos/repos.mako') def repository_create(self): c = self.load_default_context() diff --git a/rhodecode/apps/admin/views/sessions.py b/rhodecode/apps/admin/views/sessions.py --- a/rhodecode/apps/admin/views/sessions.py +++ b/rhodecode/apps/admin/views/sessions.py @@ -20,7 +20,7 @@ import logging -from pyramid.view import view_config + from pyramid.httpexceptions import HTTPFound from rhodecode.apps._base import BaseAppView @@ -37,17 +37,13 @@ log = logging.getLogger(__name__) class AdminSessionSettingsView(BaseAppView): + def load_default_context(self): c = self._get_local_tmpl_context() - - return c @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings_sessions', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_sessions(self): c = self.load_default_context() @@ -71,8 +67,6 @@ class AdminSessionSettingsView(BaseAppVi @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_settings_sessions_cleanup', request_method='POST') def settings_sessions_cleanup(self): _ = self.request.translate expire_days = safe_int(self.request.params.get('expire_days')) diff --git a/rhodecode/apps/admin/views/settings.py b/rhodecode/apps/admin/views/settings.py --- a/rhodecode/apps/admin/views/settings.py +++ b/rhodecode/apps/admin/views/settings.py @@ -27,7 +27,7 @@ import formencode import formencode.htmlfill import rhodecode -from pyramid.view import view_config + from pyramid.httpexceptions import HTTPFound, HTTPNotFound from pyramid.renderers import render from pyramid.response import Response @@ -68,7 +68,6 @@ class AdminSettingsView(BaseAppView): c.labs_active = str2bool( rhodecode.CONFIG.get('labs_settings_active', 'true')) c.navlist = navigation_list(self.request) - return c @classmethod @@ -109,9 +108,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings_vcs', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_vcs(self): c = self.load_default_context() c.active = 'vcs' @@ -139,9 +135,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_settings_vcs_update', request_method='POST', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_vcs_update(self): _ = self.request.translate c = self.load_default_context() @@ -207,9 +200,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_settings_vcs_svn_pattern_delete', request_method='POST', - renderer='json_ext', xhr=True) def settings_vcs_delete_svn_pattern(self): delete_pattern_id = self.request.POST.get('delete_svn_pattern') model = VcsSettingsModel() @@ -225,9 +215,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings_mapping', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_mapping(self): c = self.load_default_context() c.active = 'mapping' @@ -245,9 +232,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_settings_mapping_update', request_method='POST', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_mapping_update(self): _ = self.request.translate c = self.load_default_context() @@ -274,12 +258,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings.mako') - @view_config( - route_name='admin_settings_global', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_global(self): c = self.load_default_context() c.active = 'global' @@ -299,12 +277,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_settings_update', request_method='POST', - renderer='rhodecode:templates/admin/settings/settings.mako') - @view_config( - route_name='admin_settings_global_update', request_method='POST', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_global_update(self): _ = self.request.translate c = self.load_default_context() @@ -359,9 +331,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings_visual', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_visual(self): c = self.load_default_context() c.active = 'visual' @@ -379,9 +348,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_settings_visual_update', request_method='POST', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_visual_update(self): _ = self.request.translate c = self.load_default_context() @@ -441,9 +407,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings_issuetracker', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_issuetracker(self): c = self.load_default_context() c.active = 'issuetracker' @@ -470,9 +433,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_settings_issuetracker_test', request_method='POST', - renderer='string', xhr=True) def settings_issuetracker_test(self): error_container = [] @@ -490,9 +450,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_settings_issuetracker_update', request_method='POST', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_issuetracker_update(self): _ = self.request.translate self.load_default_context() @@ -527,9 +484,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_settings_issuetracker_delete', request_method='POST', - renderer='json_ext', xhr=True) def settings_issuetracker_delete(self): _ = self.request.translate self.load_default_context() @@ -547,9 +501,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings_email', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_email(self): c = self.load_default_context() c.active = 'email' @@ -568,9 +519,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_settings_email_update', request_method='POST', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_email_update(self): _ = self.request.translate c = self.load_default_context() @@ -600,9 +548,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings_hooks', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_hooks(self): c = self.load_default_context() c.active = 'hooks' @@ -624,12 +569,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_settings_hooks_update', request_method='POST', - renderer='rhodecode:templates/admin/settings/settings.mako') - @view_config( - route_name='admin_settings_hooks_delete', request_method='POST', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_hooks_update(self): _ = self.request.translate c = self.load_default_context() @@ -671,9 +610,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings_search', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_search(self): c = self.load_default_context() c.active = 'search' @@ -685,9 +621,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings_automation', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_automation(self): c = self.load_default_context() c.active = 'automation' @@ -696,9 +629,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings_labs', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_labs(self): c = self.load_default_context() if not c.labs_active: @@ -720,9 +650,6 @@ class AdminSettingsView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_settings_labs_update', request_method='POST', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_labs_update(self): _ = self.request.translate c = self.load_default_context() diff --git a/rhodecode/apps/admin/views/svn_config.py b/rhodecode/apps/admin/views/svn_config.py --- a/rhodecode/apps/admin/views/svn_config.py +++ b/rhodecode/apps/admin/views/svn_config.py @@ -20,7 +20,7 @@ import logging -from pyramid.view import view_config + from rhodecode.apps._base import BaseAppView from rhodecode.apps.svn_support.utils import generate_mod_dav_svn_config @@ -30,14 +30,11 @@ from rhodecode.lib.auth import ( log = logging.getLogger(__name__) -class SvnConfigAdminSettingsView(BaseAppView): +class AdminSvnConfigView(BaseAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='admin_settings_vcs_svn_generate_cfg', - request_method='POST', renderer='json') def vcs_svn_generate_config(self): _ = self.request.translate try: diff --git a/rhodecode/apps/admin/views/system_info.py b/rhodecode/apps/admin/views/system_info.py --- a/rhodecode/apps/admin/views/system_info.py +++ b/rhodecode/apps/admin/views/system_info.py @@ -21,7 +21,7 @@ import logging import urllib2 -from pyramid.view import view_config + import rhodecode from rhodecode.apps._base import BaseAppView @@ -42,9 +42,6 @@ class AdminSystemInfoSettingsView(BaseAp @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings_system', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings.mako') def settings_system_info(self): _ = self.request.translate c = self.load_default_context() @@ -169,9 +166,6 @@ class AdminSystemInfoSettingsView(BaseAp @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='admin_settings_system_update', request_method='GET', - renderer='rhodecode:templates/admin/settings/settings_system_update.mako') def settings_system_info_check_update(self): _ = self.request.translate c = self.load_default_context() diff --git a/rhodecode/apps/admin/views/user_groups.py b/rhodecode/apps/admin/views/user_groups.py --- a/rhodecode/apps/admin/views/user_groups.py +++ b/rhodecode/apps/admin/views/user_groups.py @@ -24,7 +24,7 @@ import formencode import formencode.htmlfill from pyramid.httpexceptions import HTTPFound -from pyramid.view import view_config + from pyramid.response import Response from pyramid.renderers import render @@ -51,19 +51,14 @@ class AdminUserGroupsView(BaseAppView, D def load_default_context(self): c = self._get_local_tmpl_context() - PermissionModel().set_global_permission_choices( c, gettext_translator=self.request.translate) - return c # permission check in data loading of # `user_groups_list_data` via UserGroupList @LoginRequired() @NotAnonymous() - @view_config( - route_name='user_groups', request_method='GET', - renderer='rhodecode:templates/admin/user_groups/user_groups.mako') def user_groups_list(self): c = self.load_default_context() return self._get_template_context(c) @@ -71,9 +66,6 @@ class AdminUserGroupsView(BaseAppView, D # permission check inside @LoginRequired() @NotAnonymous() - @view_config( - route_name='user_groups_data', request_method='GET', - renderer='json_ext', xhr=True) def user_groups_list_data(self): self.load_default_context() column_map = { @@ -197,9 +189,6 @@ class AdminUserGroupsView(BaseAppView, D @LoginRequired() @HasPermissionAnyDecorator('hg.admin', 'hg.usergroup.create.true') - @view_config( - route_name='user_groups_new', request_method='GET', - renderer='rhodecode:templates/admin/user_groups/user_group_add.mako') def user_groups_new(self): c = self.load_default_context() return self._get_template_context(c) @@ -207,9 +196,6 @@ class AdminUserGroupsView(BaseAppView, D @LoginRequired() @HasPermissionAnyDecorator('hg.admin', 'hg.usergroup.create.true') @CSRFRequired() - @view_config( - route_name='user_groups_create', request_method='POST', - renderer='rhodecode:templates/admin/user_groups/user_group_add.mako') def user_groups_create(self): _ = self.request.translate c = self.load_default_context() diff --git a/rhodecode/apps/admin/views/users.py b/rhodecode/apps/admin/views/users.py --- a/rhodecode/apps/admin/views/users.py +++ b/rhodecode/apps/admin/views/users.py @@ -24,7 +24,6 @@ import formencode import formencode.htmlfill from pyramid.httpexceptions import HTTPFound -from pyramid.view import view_config from pyramid.renderers import render from pyramid.response import Response @@ -72,19 +71,12 @@ class AdminUsersView(BaseAppView, DataGr @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='users', request_method='GET', - renderer='rhodecode:templates/admin/users/users.mako') def users_list(self): c = self.load_default_context() return self._get_template_context(c) @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - # renderer defined below - route_name='users_data', request_method='GET', - renderer='json_ext', xhr=True) def users_list_data(self): self.load_default_context() column_map = { @@ -183,9 +175,6 @@ class AdminUsersView(BaseAppView, DataGr @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='users_new', request_method='GET', - renderer='rhodecode:templates/admin/users/user_add.mako') def users_new(self): _ = self.request.translate c = self.load_default_context() @@ -196,9 +185,6 @@ class AdminUsersView(BaseAppView, DataGr @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='users_create', request_method='POST', - renderer='rhodecode:templates/admin/users/user_add.mako') def users_create(self): _ = self.request.translate c = self.load_default_context() @@ -309,9 +295,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='user_update', request_method='POST', - renderer='rhodecode:templates/admin/users/user_edit.mako') def user_update(self): _ = self.request.translate c = self.load_default_context() @@ -371,9 +354,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='user_delete', request_method='POST', - renderer='rhodecode:templates/admin/users/user_edit.mako') def user_delete(self): _ = self.request.translate c = self.load_default_context() @@ -496,9 +476,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='user_edit', request_method='GET', - renderer='rhodecode:templates/admin/users/user_edit.mako') def user_edit(self): _ = self.request.translate c = self.load_default_context() @@ -525,9 +502,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='user_edit_advanced', request_method='GET', - renderer='rhodecode:templates/admin/users/user_edit.mako') def user_edit_advanced(self): _ = self.request.translate c = self.load_default_context() @@ -584,9 +558,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='user_edit_global_perms', request_method='GET', - renderer='rhodecode:templates/admin/users/user_edit.mako') def user_edit_global_perms(self): _ = self.request.translate c = self.load_default_context() @@ -614,9 +585,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='user_edit_global_perms_update', request_method='POST', - renderer='rhodecode:templates/admin/users/user_edit.mako') def user_edit_global_perms_update(self): _ = self.request.translate c = self.load_default_context() @@ -682,9 +650,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='user_enable_force_password_reset', request_method='POST', - renderer='rhodecode:templates/admin/users/user_edit.mako') def user_enable_force_password_reset(self): _ = self.request.translate c = self.load_default_context() @@ -711,9 +676,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='user_disable_force_password_reset', request_method='POST', - renderer='rhodecode:templates/admin/users/user_edit.mako') def user_disable_force_password_reset(self): _ = self.request.translate c = self.load_default_context() @@ -741,9 +703,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='user_notice_dismiss', request_method='POST', - renderer='json_ext', xhr=True) def user_notice_dismiss(self): _ = self.request.translate c = self.load_default_context() @@ -767,9 +726,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='user_create_personal_repo_group', request_method='POST', - renderer='rhodecode:templates/admin/users/user_edit.mako') def user_create_personal_repo_group(self): """ Create personal repository group for this user @@ -821,9 +777,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='edit_user_auth_tokens', request_method='GET', - renderer='rhodecode:templates/admin/users/user_edit.mako') def auth_tokens(self): _ = self.request.translate c = self.load_default_context() @@ -843,9 +796,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='edit_user_auth_tokens_view', request_method='POST', - renderer='json_ext', xhr=True) def auth_tokens_view(self): _ = self.request.translate c = self.load_default_context() @@ -867,8 +817,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='edit_user_auth_tokens_add', request_method='POST') def auth_tokens_add(self): _ = self.request.translate c = self.load_default_context() @@ -899,8 +847,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='edit_user_auth_tokens_delete', request_method='POST') def auth_tokens_delete(self): _ = self.request.translate c = self.load_default_context() @@ -928,9 +874,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='edit_user_ssh_keys', request_method='GET', - renderer='rhodecode:templates/admin/users/user_edit.mako') def ssh_keys(self): _ = self.request.translate c = self.load_default_context() @@ -943,9 +886,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='edit_user_ssh_keys_generate_keypair', request_method='GET', - renderer='rhodecode:templates/admin/users/user_edit.mako') def ssh_keys_generate_keypair(self): _ = self.request.translate c = self.load_default_context() @@ -964,8 +904,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='edit_user_ssh_keys_add', request_method='POST') def ssh_keys_add(self): _ = self.request.translate c = self.load_default_context() @@ -1017,8 +955,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='edit_user_ssh_keys_delete', request_method='POST') def ssh_keys_delete(self): _ = self.request.translate c = self.load_default_context() @@ -1048,9 +984,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='edit_user_emails', request_method='GET', - renderer='rhodecode:templates/admin/users/user_edit.mako') def emails(self): _ = self.request.translate c = self.load_default_context() @@ -1065,8 +998,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='edit_user_emails_add', request_method='POST') def emails_add(self): _ = self.request.translate c = self.load_default_context() @@ -1105,8 +1036,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='edit_user_emails_delete', request_method='POST') def emails_delete(self): _ = self.request.translate c = self.load_default_context() @@ -1131,9 +1060,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='edit_user_ips', request_method='GET', - renderer='rhodecode:templates/admin/users/user_edit.mako') def ips(self): _ = self.request.translate c = self.load_default_context() @@ -1152,8 +1078,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='edit_user_ips_add', request_method='POST') # NOTE(marcink): this view is allowed for default users, as we can # edit their IP white list def ips_add(self): @@ -1207,8 +1131,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='edit_user_ips_delete', request_method='POST') # NOTE(marcink): this view is allowed for default users, as we can # edit their IP white list def ips_delete(self): @@ -1236,9 +1158,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='edit_user_groups_management', request_method='GET', - renderer='rhodecode:templates/admin/users/user_edit.mako') def groups_management(self): c = self.load_default_context() c.user = self.db_user @@ -1254,8 +1173,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='edit_user_groups_management_updates', request_method='POST') def groups_management_updates(self): _ = self.request.translate c = self.load_default_context() @@ -1299,9 +1216,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='edit_user_audit_logs', request_method='GET', - renderer='rhodecode:templates/admin/users/user_edit.mako') def user_audit_logs(self): _ = self.request.translate c = self.load_default_context() @@ -1329,9 +1243,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='edit_user_audit_logs_download', request_method='GET', - renderer='string') def user_audit_logs_download(self): _ = self.request.translate c = self.load_default_context() @@ -1352,9 +1263,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='edit_user_perms_summary', request_method='GET', - renderer='rhodecode:templates/admin/users/user_edit.mako') def user_perms_summary(self): _ = self.request.translate c = self.load_default_context() @@ -1367,9 +1275,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='edit_user_perms_summary_json', request_method='GET', - renderer='json_ext') def user_perms_summary_json(self): self.load_default_context() perm_user = self.db_user.AuthUser(ip_addr=self.request.remote_addr) @@ -1378,9 +1283,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') - @view_config( - route_name='edit_user_caches', request_method='GET', - renderer='rhodecode:templates/admin/users/user_edit.mako') def user_caches(self): _ = self.request.translate c = self.load_default_context() @@ -1399,8 +1301,6 @@ class UsersView(UserAppView): @LoginRequired() @HasPermissionAllDecorator('hg.admin') @CSRFRequired() - @view_config( - route_name='edit_user_caches_update', request_method='POST') def user_caches_update(self): _ = self.request.translate c = self.load_default_context() diff --git a/rhodecode/apps/channelstream/__init__.py b/rhodecode/apps/channelstream/__init__.py --- a/rhodecode/apps/channelstream/__init__.py +++ b/rhodecode/apps/channelstream/__init__.py @@ -67,6 +67,8 @@ def maybe_create_history_store(event): def includeme(config): + from rhodecode.apps.channelstream.views import ChannelstreamView + settings = config.registry.settings PLUGIN_DEFINITION['config']['enabled'] = asbool( settings.get('channelstream.enabled')) @@ -85,12 +87,20 @@ def includeme(config): config.add_route( name='channelstream_connect', pattern=ADMIN_PREFIX + '/channelstream/connect') + config.add_view( + ChannelstreamView, + attr='channelstream_connect', + route_name='channelstream_connect', renderer='json_ext') + config.add_route( name='channelstream_subscribe', pattern=ADMIN_PREFIX + '/channelstream/subscribe') + config.add_view( + ChannelstreamView, + attr='channelstream_subscribe', + route_name='channelstream_subscribe', renderer='json_ext') + config.add_route( name='channelstream_proxy', pattern=settings.get('channelstream.proxy_path') or '/_channelstream') - # Scan module for configuration decorators. - config.scan('.views', ignore='.tests') diff --git a/rhodecode/apps/channelstream/views.py b/rhodecode/apps/channelstream/views.py --- a/rhodecode/apps/channelstream/views.py +++ b/rhodecode/apps/channelstream/views.py @@ -21,7 +21,7 @@ import logging import uuid -from pyramid.view import view_config + from pyramid.httpexceptions import HTTPBadRequest, HTTPForbidden, HTTPBadGateway from rhodecode.apps._base import BaseAppView @@ -54,8 +54,7 @@ class ChannelstreamView(BaseAppView): return c @NotAnonymous() - @view_config(route_name='channelstream_connect', renderer='json_ext') - def connect(self): + def channelstream_connect(self): """ handle authorization of users trying to connect """ self.load_default_context() @@ -132,8 +131,7 @@ class ChannelstreamView(BaseAppView): return connect_result @NotAnonymous() - @view_config(route_name='channelstream_subscribe', renderer='json_ext') - def subscribe(self): + def channelstream_subscribe(self): """ can be used to subscribe specific connection to other channels """ self.load_default_context() try: diff --git a/rhodecode/apps/debug_style/__init__.py b/rhodecode/apps/debug_style/__init__.py --- a/rhodecode/apps/debug_style/__init__.py +++ b/rhodecode/apps/debug_style/__init__.py @@ -35,6 +35,8 @@ class DebugStylePredicate(object): def includeme(config): + from rhodecode.apps.debug_style.views import DebugStyleView + config.add_route_predicate( 'debug_style', DebugStylePredicate) @@ -42,18 +44,38 @@ def includeme(config): name='debug_style_home', pattern=ADMIN_PREFIX + '/debug_style', debug_style=True) + config.add_view( + DebugStyleView, + attr='index', + route_name='debug_style_home', request_method='GET', + renderer=None) + config.add_route( name='debug_style_email', pattern=ADMIN_PREFIX + '/debug_style/email/{email_id}', debug_style=True) + config.add_view( + DebugStyleView, + attr='render_email', + route_name='debug_style_email', request_method='GET', + renderer=None) + config.add_route( name='debug_style_email_plain_rendered', pattern=ADMIN_PREFIX + '/debug_style/email-rendered/{email_id}', debug_style=True) + config.add_view( + DebugStyleView, + attr='render_email', + route_name='debug_style_email_plain_rendered', request_method='GET', + renderer=None) + config.add_route( name='debug_style_template', pattern=ADMIN_PREFIX + '/debug_style/t/{t_path}', debug_style=True) - - # Scan module for configuration decorators. - config.scan('.views', ignore='.tests') + config.add_view( + DebugStyleView, + attr='template', + route_name='debug_style_template', request_method='GET', + renderer=None) diff --git a/rhodecode/apps/debug_style/views.py b/rhodecode/apps/debug_style/views.py --- a/rhodecode/apps/debug_style/views.py +++ b/rhodecode/apps/debug_style/views.py @@ -22,7 +22,6 @@ import os import logging import datetime -from pyramid.view import view_config from pyramid.renderers import render_to_response from rhodecode.apps._base import BaseAppView from rhodecode.lib.celerylib import run_task, tasks @@ -37,12 +36,8 @@ class DebugStyleView(BaseAppView): def load_default_context(self): c = self._get_local_tmpl_context() - return c - @view_config( - route_name='debug_style_home', request_method='GET', - renderer=None) def index(self): c = self.load_default_context() c.active = 'index' @@ -51,12 +46,6 @@ class DebugStyleView(BaseAppView): 'debug_style/index.html', self._get_template_context(c), request=self.request) - @view_config( - route_name='debug_style_email', request_method='GET', - renderer=None) - @view_config( - route_name='debug_style_email_plain_rendered', request_method='GET', - renderer=None) def render_email(self): c = self.load_default_context() email_id = self.request.matchdict['email_id'] @@ -457,9 +446,6 @@ users: description edit fixes template, self._get_template_context(c), request=self.request) - @view_config( - route_name='debug_style_template', request_method='GET', - renderer=None) def template(self): t_path = self.request.matchdict['t_path'] c = self.load_default_context() @@ -483,4 +469,3 @@ users: description edit fixes return render_to_response( 'debug_style/' + t_path, self._get_template_context(c), request=self.request) - diff --git a/rhodecode/apps/file_store/__init__.py b/rhodecode/apps/file_store/__init__.py --- a/rhodecode/apps/file_store/__init__.py +++ b/rhodecode/apps/file_store/__init__.py @@ -35,18 +35,31 @@ def _sanitize_settings_and_apply_default def includeme(config): + from rhodecode.apps.file_store.views import FileStoreView + settings = config.registry.settings _sanitize_settings_and_apply_defaults(settings) config.add_route( name='upload_file', pattern='/_file_store/upload') + config.add_view( + FileStoreView, + attr='upload_file', + route_name='upload_file', request_method='POST', renderer='json_ext') + config.add_route( name='download_file', pattern='/_file_store/download/{fid:.*}') + config.add_view( + FileStoreView, + attr='download_file', + route_name='download_file') + config.add_route( name='download_file_by_token', pattern='/_file_store/token-download/{_auth_token}/{fid:.*}') - - # Scan module for configuration decorators. - config.scan('.views', ignore='.tests') + config.add_view( + FileStoreView, + attr='download_file_by_token', + route_name='download_file_by_token') diff --git a/rhodecode/apps/file_store/views.py b/rhodecode/apps/file_store/views.py --- a/rhodecode/apps/file_store/views.py +++ b/rhodecode/apps/file_store/views.py @@ -19,7 +19,7 @@ # and proprietary license terms, please see https://rhodecode.com/licenses/ import logging -from pyramid.view import view_config + from pyramid.response import FileResponse from pyramid.httpexceptions import HTTPFound, HTTPNotFound @@ -128,7 +128,6 @@ class FileStoreView(BaseAppView): @LoginRequired() @NotAnonymous() @CSRFRequired() - @view_config(route_name='upload_file', request_method='POST', renderer='json_ext') def upload_file(self): self.load_default_context() file_obj = self.request.POST.get(self.upload_key) @@ -182,7 +181,6 @@ class FileStoreView(BaseAppView): 'access_path': h.route_path('download_file', fid=store_uid)} # ACL is checked by scopes, if no scope the file is accessible to all - @view_config(route_name='download_file') def download_file(self): self.load_default_context() file_uid = self.request.matchdict['fid'] @@ -192,7 +190,6 @@ class FileStoreView(BaseAppView): # in addition to @LoginRequired ACL is checked by scopes @LoginRequired(auth_token_access=[UserApiKeys.ROLE_ARTIFACT_DOWNLOAD]) @NotAnonymous() - @view_config(route_name='download_file_by_token') def download_file_by_token(self): """ Special view that allows to access the download file by special URL that diff --git a/rhodecode/apps/gist/__init__.py b/rhodecode/apps/gist/__init__.py --- a/rhodecode/apps/gist/__init__.py +++ b/rhodecode/apps/gist/__init__.py @@ -21,42 +21,100 @@ from rhodecode.apps._base import ADMIN_P def admin_routes(config): + from rhodecode.apps.gist.views import GistView + config.add_route( name='gists_show', pattern='/gists') + config.add_view( + GistView, + attr='gist_show_all', + route_name='gists_show', request_method='GET', + renderer='rhodecode:templates/admin/gists/gist_index.mako') + config.add_route( name='gists_new', pattern='/gists/new') + config.add_view( + GistView, + attr='gist_new', + route_name='gists_new', request_method='GET', + renderer='rhodecode:templates/admin/gists/gist_new.mako') + config.add_route( name='gists_create', pattern='/gists/create') + config.add_view( + GistView, + attr='gist_create', + route_name='gists_create', request_method='POST', + renderer='rhodecode:templates/admin/gists/gist_new.mako') config.add_route( name='gist_show', pattern='/gists/{gist_id}') + config.add_view( + GistView, + attr='gist_show', + route_name='gist_show', request_method='GET', + renderer='rhodecode:templates/admin/gists/gist_show.mako') + + config.add_route( + name='gist_show_rev', + pattern='/gists/{gist_id}/rev/{revision}') + + config.add_view( + GistView, + attr='gist_show', + route_name='gist_show_rev', request_method='GET', + renderer='rhodecode:templates/admin/gists/gist_show.mako') + + config.add_route( + name='gist_show_formatted', + pattern='/gists/{gist_id}/rev/{revision}/{format}') + config.add_view( + GistView, + attr='gist_show', + route_name='gist_show_formatted', request_method='GET', + renderer=None) + + config.add_route( + name='gist_show_formatted_path', + pattern='/gists/{gist_id}/rev/{revision}/{format}/{f_path:.*}') + config.add_view( + GistView, + attr='gist_show', + route_name='gist_show_formatted_path', request_method='GET', + renderer=None) config.add_route( name='gist_delete', pattern='/gists/{gist_id}/delete') + config.add_view( + GistView, + attr='gist_delete', + route_name='gist_delete', request_method='POST') config.add_route( name='gist_edit', pattern='/gists/{gist_id}/edit') + config.add_view( + GistView, + attr='gist_edit', + route_name='gist_edit', request_method='GET', + renderer='rhodecode:templates/admin/gists/gist_edit.mako') + + config.add_route( + name='gist_update', pattern='/gists/{gist_id}/update') + config.add_view( + GistView, + attr='gist_update', + route_name='gist_update', request_method='POST', + renderer='rhodecode:templates/admin/gists/gist_edit.mako') config.add_route( name='gist_edit_check_revision', pattern='/gists/{gist_id}/edit/check_revision') - - config.add_route( - name='gist_update', pattern='/gists/{gist_id}/update') - - config.add_route( - name='gist_show_rev', - pattern='/gists/{gist_id}/{revision}') - config.add_route( - name='gist_show_formatted', - pattern='/gists/{gist_id}/{revision}/{format}') - - config.add_route( - name='gist_show_formatted_path', - pattern='/gists/{gist_id}/{revision}/{format}/{f_path:.*}') + config.add_view( + GistView, + attr='gist_edit_check_revision', + route_name='gist_edit_check_revision', request_method='GET', + renderer='json_ext') def includeme(config): config.include(admin_routes, route_prefix=ADMIN_PREFIX) - # Scan module for configuration decorators. - config.scan('.views', ignore='.tests') diff --git a/rhodecode/apps/gist/tests/test_admin_gists.py b/rhodecode/apps/gist/tests/test_admin_gists.py --- a/rhodecode/apps/gist/tests/test_admin_gists.py +++ b/rhodecode/apps/gist/tests/test_admin_gists.py @@ -43,9 +43,9 @@ def route_path(name, params=None, **kwar 'gist_edit': ADMIN_PREFIX + '/gists/{gist_id}/edit', 'gist_edit_check_revision': ADMIN_PREFIX + '/gists/{gist_id}/edit/check_revision', 'gist_update': ADMIN_PREFIX + '/gists/{gist_id}/update', - 'gist_show_rev': ADMIN_PREFIX + '/gists/{gist_id}/{revision}', - 'gist_show_formatted': ADMIN_PREFIX + '/gists/{gist_id}/{revision}/{format}', - 'gist_show_formatted_path': ADMIN_PREFIX + '/gists/{gist_id}/{revision}/{format}/{f_path}', + 'gist_show_rev': ADMIN_PREFIX + '/gists/{gist_id}/rev/{revision}', + 'gist_show_formatted': ADMIN_PREFIX + '/gists/{gist_id}/rev/{revision}/{format}', + 'gist_show_formatted_path': ADMIN_PREFIX + '/gists/{gist_id}/rev/{revision}/{format}/{f_path}', }[name].format(**kwargs) diff --git a/rhodecode/apps/gist/views.py b/rhodecode/apps/gist/views.py --- a/rhodecode/apps/gist/views.py +++ b/rhodecode/apps/gist/views.py @@ -26,7 +26,6 @@ import formencode.htmlfill import peppercorn from pyramid.httpexceptions import HTTPNotFound, HTTPFound, HTTPBadRequest -from pyramid.view import view_config from pyramid.renderers import render from pyramid.response import Response @@ -70,9 +69,6 @@ class GistView(BaseAppView): return c @LoginRequired() - @view_config( - route_name='gists_show', request_method='GET', - renderer='rhodecode:templates/admin/gists/gist_index.mako') def gist_show_all(self): c = self.load_default_context() @@ -134,9 +130,6 @@ class GistView(BaseAppView): @LoginRequired() @NotAnonymous() - @view_config( - route_name='gists_new', request_method='GET', - renderer='rhodecode:templates/admin/gists/gist_new.mako') def gist_new(self): c = self.load_default_context() return self._get_template_context(c) @@ -144,9 +137,6 @@ class GistView(BaseAppView): @LoginRequired() @NotAnonymous() @CSRFRequired() - @view_config( - route_name='gists_create', request_method='POST', - renderer='rhodecode:templates/admin/gists/gist_new.mako') def gist_create(self): _ = self.request.translate c = self.load_default_context() @@ -222,8 +212,6 @@ class GistView(BaseAppView): @LoginRequired() @NotAnonymous() @CSRFRequired() - @view_config( - route_name='gist_delete', request_method='POST') def gist_delete(self): _ = self.request.translate gist_id = self.request.matchdict['gist_id'] @@ -263,18 +251,6 @@ class GistView(BaseAppView): return gist @LoginRequired() - @view_config( - route_name='gist_show', request_method='GET', - renderer='rhodecode:templates/admin/gists/gist_show.mako') - @view_config( - route_name='gist_show_rev', request_method='GET', - renderer='rhodecode:templates/admin/gists/gist_show.mako') - @view_config( - route_name='gist_show_formatted', request_method='GET', - renderer=None) - @view_config( - route_name='gist_show_formatted_path', request_method='GET', - renderer=None) def gist_show(self): gist_id = self.request.matchdict['gist_id'] @@ -307,9 +283,6 @@ class GistView(BaseAppView): @LoginRequired() @NotAnonymous() - @view_config( - route_name='gist_edit', request_method='GET', - renderer='rhodecode:templates/admin/gists/gist_edit.mako') def gist_edit(self): _ = self.request.translate gist_id = self.request.matchdict['gist_id'] @@ -341,9 +314,6 @@ class GistView(BaseAppView): @LoginRequired() @NotAnonymous() @CSRFRequired() - @view_config( - route_name='gist_update', request_method='POST', - renderer='rhodecode:templates/admin/gists/gist_edit.mako') def gist_update(self): _ = self.request.translate gist_id = self.request.matchdict['gist_id'] @@ -397,9 +367,6 @@ class GistView(BaseAppView): @LoginRequired() @NotAnonymous() - @view_config( - route_name='gist_edit_check_revision', request_method='GET', - renderer='json_ext') def gist_edit_check_revision(self): _ = self.request.translate gist_id = self.request.matchdict['gist_id'] diff --git a/rhodecode/apps/home/__init__.py b/rhodecode/apps/home/__init__.py --- a/rhodecode/apps/home/__init__.py +++ b/rhodecode/apps/home/__init__.py @@ -38,56 +38,110 @@ class VCSCallPredicate(object): def includeme(config): + from rhodecode.apps.home.views import HomeView + + config.add_route_predicate( + 'skip_vcs_call', VCSCallPredicate) config.add_route( name='home', pattern='/') + config.add_view( + HomeView, + attr='main_page', + route_name='home', request_method='GET', + renderer='rhodecode:templates/index.mako') config.add_route( name='main_page_repos_data', pattern='/_home_repos') + config.add_view( + HomeView, + attr='main_page_repos_data', + route_name='main_page_repos_data', + request_method='GET', renderer='json_ext', xhr=True) config.add_route( name='main_page_repo_groups_data', pattern='/_home_repo_groups') + config.add_view( + HomeView, + attr='main_page_repo_groups_data', + route_name='main_page_repo_groups_data', + request_method='GET', renderer='json_ext', xhr=True) config.add_route( name='user_autocomplete_data', pattern='/_users') + config.add_view( + HomeView, + attr='user_autocomplete_data', + route_name='user_autocomplete_data', request_method='GET', + renderer='json_ext', xhr=True) config.add_route( name='user_group_autocomplete_data', pattern='/_user_groups') + config.add_view( + HomeView, + attr='user_group_autocomplete_data', + route_name='user_group_autocomplete_data', request_method='GET', + renderer='json_ext', xhr=True) config.add_route( name='repo_list_data', pattern='/_repos') + config.add_view( + HomeView, + attr='repo_list_data', + route_name='repo_list_data', request_method='GET', + renderer='json_ext', xhr=True) config.add_route( name='repo_group_list_data', pattern='/_repo_groups') + config.add_view( + HomeView, + attr='repo_group_list_data', + route_name='repo_group_list_data', request_method='GET', + renderer='json_ext', xhr=True) config.add_route( name='goto_switcher_data', pattern='/_goto_data') + config.add_view( + HomeView, + attr='goto_switcher_data', + route_name='goto_switcher_data', request_method='GET', + renderer='json_ext', xhr=True) config.add_route( name='markup_preview', pattern='/_markup_preview') + config.add_view( + HomeView, + attr='markup_preview', + route_name='markup_preview', request_method='POST', + renderer='string', xhr=True) config.add_route( name='file_preview', pattern='/_file_preview') + config.add_view( + HomeView, + attr='file_preview', + route_name='file_preview', request_method='POST', + renderer='string', xhr=True) config.add_route( name='store_user_session_value', pattern='/_store_session_attr') + config.add_view( + HomeView, + attr='store_user_session_attr', + route_name='store_user_session_value', request_method='POST', + renderer='string', xhr=True) # register our static links via redirection mechanism routing_links.connect_redirection_links(config) - # Scan module for configuration decorators. - config.scan('.views', ignore='.tests') - - config.add_route_predicate( - 'skip_vcs_call', VCSCallPredicate) diff --git a/rhodecode/apps/home/views.py b/rhodecode/apps/home/views.py --- a/rhodecode/apps/home/views.py +++ b/rhodecode/apps/home/views.py @@ -23,7 +23,6 @@ import logging import collections from pyramid.httpexceptions import HTTPNotFound -from pyramid.view import view_config from rhodecode.apps._base import BaseAppView, DataGridAppView from rhodecode.lib import helpers as h @@ -50,13 +49,9 @@ class HomeView(BaseAppView, DataGridAppV def load_default_context(self): c = self._get_local_tmpl_context() c.user = c.auth_user.get_instance() - return c @LoginRequired() - @view_config( - route_name='user_autocomplete_data', request_method='GET', - renderer='json_ext', xhr=True) def user_autocomplete_data(self): self.load_default_context() query = self.request.GET.get('query') @@ -88,9 +83,6 @@ class HomeView(BaseAppView, DataGridAppV @LoginRequired() @NotAnonymous() - @view_config( - route_name='user_group_autocomplete_data', request_method='GET', - renderer='json_ext', xhr=True) def user_group_autocomplete_data(self): self.load_default_context() query = self.request.GET.get('query') @@ -434,9 +426,6 @@ class HomeView(BaseAppView, DataGridAppV return files, True @LoginRequired() - @view_config( - route_name='repo_list_data', request_method='GET', - renderer='json_ext', xhr=True) def repo_list_data(self): _ = self.request.translate self.load_default_context() @@ -461,9 +450,6 @@ class HomeView(BaseAppView, DataGridAppV return data @LoginRequired() - @view_config( - route_name='repo_group_list_data', request_method='GET', - renderer='json_ext', xhr=True) def repo_group_list_data(self): _ = self.request.translate self.load_default_context() @@ -619,9 +605,6 @@ class HomeView(BaseAppView, DataGridAppV return queries @LoginRequired() - @view_config( - route_name='goto_switcher_data', request_method='GET', - renderer='json_ext', xhr=True) def goto_switcher_data(self): c = self.load_default_context() @@ -750,9 +733,6 @@ class HomeView(BaseAppView, DataGridAppV return {'suggestions': res} @LoginRequired() - @view_config( - route_name='home', request_method='GET', - renderer='rhodecode:templates/index.mako') def main_page(self): c = self.load_default_context() c.repo_group = None @@ -789,9 +769,6 @@ class HomeView(BaseAppView, DataGridAppV self._rhodecode_user, repo_group_id) @LoginRequired() - @view_config( - route_name='main_page_repo_groups_data', - request_method='GET', renderer='json_ext', xhr=True) def main_page_repo_groups_data(self): self.load_default_context() repo_group_id = safe_int(self.request.GET.get('repo_group_id')) @@ -806,9 +783,6 @@ class HomeView(BaseAppView, DataGridAppV return self._main_page_repo_groups_data(repo_group_id) @LoginRequired() - @view_config( - route_name='main_page_repos_data', - request_method='GET', renderer='json_ext', xhr=True) def main_page_repos_data(self): self.load_default_context() repo_group_id = safe_int(self.request.GET.get('repo_group_id')) @@ -824,12 +798,6 @@ class HomeView(BaseAppView, DataGridAppV @LoginRequired() @HasRepoGroupPermissionAnyDecorator(*AuthUser.repo_group_read_perms) - @view_config( - route_name='repo_group_home', request_method='GET', - renderer='rhodecode:templates/index_repo_group.mako') - @view_config( - route_name='repo_group_home_slash', request_method='GET', - renderer='rhodecode:templates/index_repo_group.mako') def repo_group_main_page(self): c = self.load_default_context() c.repo_group = self.request.db_repo_group @@ -837,9 +805,6 @@ class HomeView(BaseAppView, DataGridAppV @LoginRequired() @CSRFRequired() - @view_config( - route_name='markup_preview', request_method='POST', - renderer='string', xhr=True) def markup_preview(self): # Technically a CSRF token is not needed as no state changes with this # call. However, as this is a POST is better to have it, so automated @@ -855,9 +820,6 @@ class HomeView(BaseAppView, DataGridAppV @LoginRequired() @CSRFRequired() - @view_config( - route_name='file_preview', request_method='POST', - renderer='string', xhr=True) def file_preview(self): # Technically a CSRF token is not needed as no state changes with this # call. However, as this is a POST is better to have it, so automated @@ -883,9 +845,6 @@ class HomeView(BaseAppView, DataGridAppV @LoginRequired() @CSRFRequired() - @view_config( - route_name='store_user_session_value', request_method='POST', - renderer='string', xhr=True) def store_user_session_attr(self): key = self.request.POST.get('key') val = self.request.POST.get('val') diff --git a/rhodecode/apps/hovercards/__init__.py b/rhodecode/apps/hovercards/__init__.py --- a/rhodecode/apps/hovercards/__init__.py +++ b/rhodecode/apps/hovercards/__init__.py @@ -20,26 +20,48 @@ def includeme(config): - + from rhodecode.apps.hovercards.views import HoverCardsView, HoverCardsRepoView config.add_route( name='hovercard_user', pattern='/_hovercard/user/{user_id}') + config.add_view( + HoverCardsView, + attr='hovercard_user', + route_name='hovercard_user', request_method='GET', xhr=True, + renderer='rhodecode:templates/hovercards/hovercard_user.mako') config.add_route( name='hovercard_username', pattern='/_hovercard/username/{username}') + config.add_view( + HoverCardsView, + attr='hovercard_username', + route_name='hovercard_username', request_method='GET', xhr=True, + renderer='rhodecode:templates/hovercards/hovercard_user.mako') config.add_route( name='hovercard_user_group', pattern='/_hovercard/user_group/{user_group_id}') + config.add_view( + HoverCardsView, + attr='hovercard_user_group', + route_name='hovercard_user_group', request_method='GET', xhr=True, + renderer='rhodecode:templates/hovercards/hovercard_user_group.mako') config.add_route( name='hovercard_pull_request', pattern='/_hovercard/pull_request/{pull_request_id}') + config.add_view( + HoverCardsView, + attr='hovercard_pull_request', + route_name='hovercard_pull_request', request_method='GET', xhr=True, + renderer='rhodecode:templates/hovercards/hovercard_pull_request.mako') config.add_route( name='hovercard_repo_commit', pattern='/_hovercard/commit/{repo_name:.*?[^/]}/{commit_id}', repo_route=True) - - # Scan module for configuration decorators. - config.scan('.views', ignore='.tests') + config.add_view( + HoverCardsRepoView, + attr='hovercard_repo_commit', + route_name='hovercard_repo_commit', request_method='GET', xhr=True, + renderer='rhodecode:templates/hovercards/hovercard_repo_commit.mako') diff --git a/rhodecode/apps/hovercards/views.py b/rhodecode/apps/hovercards/views.py --- a/rhodecode/apps/hovercards/views.py +++ b/rhodecode/apps/hovercards/views.py @@ -23,7 +23,7 @@ import logging import collections from pyramid.httpexceptions import HTTPNotFound -from pyramid.view import view_config + from rhodecode.apps._base import BaseAppView, RepoAppView from rhodecode.lib import helpers as h @@ -54,9 +54,6 @@ class HoverCardsView(BaseAppView): return c @LoginRequired() - @view_config( - route_name='hovercard_user', request_method='GET', xhr=True, - renderer='rhodecode:templates/hovercards/hovercard_user.mako') def hovercard_user(self): c = self.load_default_context() user_id = self.request.matchdict['user_id'] @@ -64,9 +61,6 @@ class HoverCardsView(BaseAppView): return self._get_template_context(c) @LoginRequired() - @view_config( - route_name='hovercard_username', request_method='GET', xhr=True, - renderer='rhodecode:templates/hovercards/hovercard_user.mako') def hovercard_username(self): c = self.load_default_context() username = self.request.matchdict['username'] @@ -77,9 +71,6 @@ class HoverCardsView(BaseAppView): return self._get_template_context(c) @LoginRequired() - @view_config( - route_name='hovercard_user_group', request_method='GET', xhr=True, - renderer='rhodecode:templates/hovercards/hovercard_user_group.mako') def hovercard_user_group(self): c = self.load_default_context() user_group_id = self.request.matchdict['user_group_id'] @@ -87,9 +78,6 @@ class HoverCardsView(BaseAppView): return self._get_template_context(c) @LoginRequired() - @view_config( - route_name='hovercard_pull_request', request_method='GET', xhr=True, - renderer='rhodecode:templates/hovercards/hovercard_pull_request.mako') def hovercard_pull_request(self): c = self.load_default_context() c.pull_request = PullRequest.get_or_404( @@ -107,9 +95,6 @@ class HoverCardsRepoView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='hovercard_repo_commit', request_method='GET', xhr=True, - renderer='rhodecode:templates/hovercards/hovercard_repo_commit.mako') def hovercard_repo_commit(self): c = self.load_default_context() commit_id = self.request.matchdict['commit_id'] diff --git a/rhodecode/apps/journal/__init__.py b/rhodecode/apps/journal/__init__.py --- a/rhodecode/apps/journal/__init__.py +++ b/rhodecode/apps/journal/__init__.py @@ -23,31 +23,80 @@ from rhodecode.apps._base import ADMIN_P def admin_routes(config): + from rhodecode.apps.journal.views import JournalView config.add_route( name='journal', pattern='/journal') + config.add_view( + JournalView, + attr='journal', + route_name='journal', request_method='GET', + renderer=None) + config.add_route( name='journal_rss', pattern='/journal/rss') + config.add_view( + JournalView, + attr='journal_rss', + route_name='journal_rss', request_method='GET', + renderer=None) + config.add_route( name='journal_atom', pattern='/journal/atom') + config.add_view( + JournalView, + attr='journal_atom', + route_name='journal_atom', request_method='GET', + renderer=None) config.add_route( name='journal_public', pattern='/public_journal') + config.add_view( + JournalView, + attr='journal_public', + route_name='journal_public', request_method='GET', + renderer=None) + config.add_route( name='journal_public_atom', pattern='/public_journal/atom') + config.add_view( + JournalView, + attr='journal_public_atom', + route_name='journal_public_atom', request_method='GET', + renderer=None) + config.add_route( name='journal_public_atom_old', pattern='/public_journal_atom') + config.add_view( + JournalView, + attr='journal_public_atom', + route_name='journal_public_atom_old', request_method='GET', + renderer=None) config.add_route( name='journal_public_rss', pattern='/public_journal/rss') + config.add_view( + JournalView, + attr='journal_public_rss', + route_name='journal_public_rss', request_method='GET', + renderer=None) + config.add_route( name='journal_public_rss_old', pattern='/public_journal_rss') + config.add_view( + JournalView, + attr='journal_public_rss', + route_name='journal_public_rss_old', request_method='GET', + renderer=None) config.add_route( name='toggle_following', pattern='/toggle_following') + config.add_view( + JournalView, + attr='toggle_following', + route_name='toggle_following', request_method='POST', + renderer='json_ext') def includeme(config): config.include(admin_routes, route_prefix=ADMIN_PREFIX) - # Scan module for configuration decorators. - config.scan('.views', ignore='.tests') diff --git a/rhodecode/apps/journal/views.py b/rhodecode/apps/journal/views.py --- a/rhodecode/apps/journal/views.py +++ b/rhodecode/apps/journal/views.py @@ -18,13 +18,9 @@ # RhodeCode Enterprise Edition, including its added features, Support services, # and proprietary license terms, please see https://rhodecode.com/licenses/ - import logging import itertools - - -from pyramid.view import view_config from pyramid.httpexceptions import HTTPBadRequest from pyramid.response import Response from pyramid.renderers import render @@ -218,9 +214,6 @@ class JournalView(BaseAppView): @LoginRequired() @NotAnonymous() - @view_config( - route_name='journal', request_method='GET', - renderer=None) def journal(self): c = self.load_default_context() @@ -258,9 +251,6 @@ class JournalView(BaseAppView): @LoginRequired(auth_token_access=[UserApiKeys.ROLE_FEED]) @NotAnonymous() - @view_config( - route_name='journal_atom', request_method='GET', - renderer=None) def journal_atom(self): """ Produce an atom-1.0 feed via feedgenerator module @@ -274,9 +264,6 @@ class JournalView(BaseAppView): @LoginRequired(auth_token_access=[UserApiKeys.ROLE_FEED]) @NotAnonymous() - @view_config( - route_name='journal_rss', request_method='GET', - renderer=None) def journal_rss(self): """ Produce an rss feed via feedgenerator module @@ -289,39 +276,6 @@ class JournalView(BaseAppView): return self._rss_feed(following_repos, c.search_term, public=False) @LoginRequired() - @NotAnonymous() - @CSRFRequired() - @view_config( - route_name='toggle_following', request_method='POST', - renderer='json_ext') - def toggle_following(self): - user_id = self.request.POST.get('follows_user_id') - if user_id: - try: - ScmModel().toggle_following_user(user_id, self._rhodecode_user.user_id) - Session().commit() - return 'ok' - except Exception: - raise HTTPBadRequest() - - repo_id = self.request.POST.get('follows_repo_id') - repo = Repository.get_or_404(repo_id) - perm_set = ['repository.read', 'repository.write', 'repository.admin'] - has_perm = HasRepoPermissionAny(*perm_set)(repo.repo_name, 'RepoWatch check') - if repo and has_perm: - try: - ScmModel().toggle_following_repo(repo_id, self._rhodecode_user.user_id) - Session().commit() - return 'ok' - except Exception: - raise HTTPBadRequest() - - raise HTTPBadRequest() - - @LoginRequired() - @view_config( - route_name='journal_public', request_method='GET', - renderer=None) def journal_public(self): c = self.load_default_context() # Return a rendered template @@ -357,9 +311,6 @@ class JournalView(BaseAppView): return Response(html) @LoginRequired(auth_token_access=[UserApiKeys.ROLE_FEED]) - @view_config( - route_name='journal_public_atom', request_method='GET', - renderer=None) def journal_public_atom(self): """ Produce an atom-1.0 feed via feedgenerator module @@ -373,9 +324,6 @@ class JournalView(BaseAppView): return self._atom_feed(following_repos, c.search_term) @LoginRequired(auth_token_access=[UserApiKeys.ROLE_FEED]) - @view_config( - route_name='journal_public_rss', request_method='GET', - renderer=None) def journal_public_rss(self): """ Produce an rss2 feed via feedgenerator module @@ -387,3 +335,30 @@ class JournalView(BaseAppView): .all() return self._rss_feed(following_repos, c.search_term) + + @LoginRequired() + @NotAnonymous() + @CSRFRequired() + def toggle_following(self): + user_id = self.request.POST.get('follows_user_id') + if user_id: + try: + ScmModel().toggle_following_user(user_id, self._rhodecode_user.user_id) + Session().commit() + return 'ok' + except Exception: + raise HTTPBadRequest() + + repo_id = self.request.POST.get('follows_repo_id') + repo = Repository.get_or_404(repo_id) + perm_set = ['repository.read', 'repository.write', 'repository.admin'] + has_perm = HasRepoPermissionAny(*perm_set)(repo.repo_name, 'RepoWatch check') + if repo and has_perm: + try: + ScmModel().toggle_following_repo(repo_id, self._rhodecode_user.user_id) + Session().commit() + return 'ok' + except Exception: + raise HTTPBadRequest() + + raise HTTPBadRequest() diff --git a/rhodecode/apps/login/__init__.py b/rhodecode/apps/login/__init__.py --- a/rhodecode/apps/login/__init__.py +++ b/rhodecode/apps/login/__init__.py @@ -23,22 +23,57 @@ from rhodecode.apps._base import ADMIN_P def includeme(config): - + from rhodecode.apps.login.views import LoginView + config.add_route( name='login', pattern=ADMIN_PREFIX + '/login') + config.add_view( + LoginView, + attr='login', + route_name='login', request_method='GET', + renderer='rhodecode:templates/login.mako') + config.add_view( + LoginView, + attr='login_post', + route_name='login', request_method='POST', + renderer='rhodecode:templates/login.mako') + config.add_route( name='logout', pattern=ADMIN_PREFIX + '/logout') + config.add_view( + LoginView, + attr='logout', + route_name='logout', request_method='POST') + config.add_route( name='register', pattern=ADMIN_PREFIX + '/register') + config.add_view( + LoginView, + attr='register', + route_name='register', request_method='GET', + renderer='rhodecode:templates/register.mako') + config.add_view( + LoginView, + attr='register_post', + route_name='register', request_method='POST', + renderer='rhodecode:templates/register.mako') + config.add_route( name='reset_password', pattern=ADMIN_PREFIX + '/password_reset') + config.add_view( + LoginView, + attr='password_reset', + route_name='reset_password', request_method=('GET', 'POST'), + renderer='rhodecode:templates/password_reset.mako') + config.add_route( name='reset_password_confirmation', pattern=ADMIN_PREFIX + '/password_reset_confirmation') - - # Scan module for configuration decorators. - config.scan('.views', ignore='.tests') + config.add_view( + LoginView, + attr='password_reset_confirmation', + route_name='reset_password_confirmation', request_method='GET') diff --git a/rhodecode/apps/login/views.py b/rhodecode/apps/login/views.py --- a/rhodecode/apps/login/views.py +++ b/rhodecode/apps/login/views.py @@ -28,7 +28,7 @@ import urlparse import requests from pyramid.httpexceptions import HTTPFound -from pyramid.view import view_config + from rhodecode.apps._base import BaseAppView from rhodecode.authentication.base import authenticate, HTTP_TYPE @@ -114,7 +114,6 @@ class LoginView(BaseAppView): def load_default_context(self): c = self._get_local_tmpl_context() c.came_from = get_came_from(self.request) - return c def _get_captcha_data(self): @@ -148,9 +147,6 @@ class LoginView(BaseAppView): return captcha_status, captcha_message - @view_config( - route_name='login', request_method='GET', - renderer='rhodecode:templates/login.mako') def login(self): c = self.load_default_context() auth_user = self._rhodecode_user @@ -175,9 +171,6 @@ class LoginView(BaseAppView): return self._get_template_context(c) - @view_config( - route_name='login', request_method='POST', - renderer='rhodecode:templates/login.mako') def login_post(self): c = self.load_default_context() @@ -229,7 +222,6 @@ class LoginView(BaseAppView): return self._get_template_context(c) @CSRFRequired() - @view_config(route_name='logout', request_method='POST') def logout(self): auth_user = self._rhodecode_user log.info('Deleting session for user: `%s`', auth_user) @@ -243,9 +235,6 @@ class LoginView(BaseAppView): @HasPermissionAnyDecorator( 'hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate') - @view_config( - route_name='register', request_method='GET', - renderer='rhodecode:templates/register.mako',) def register(self, defaults=None, errors=None): c = self.load_default_context() defaults = defaults or {} @@ -270,9 +259,6 @@ class LoginView(BaseAppView): @HasPermissionAnyDecorator( 'hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate') - @view_config( - route_name='register', request_method='POST', - renderer='rhodecode:templates/register.mako') def register_post(self): from rhodecode.authentication.plugins import auth_rhodecode @@ -353,9 +339,6 @@ class LoginView(BaseAppView): h.flash(e, category='error') return self.register() - @view_config( - route_name='reset_password', request_method=('GET', 'POST'), - renderer='rhodecode:templates/password_reset.mako') def password_reset(self): c = self.load_default_context() captcha = self._get_captcha_data() @@ -454,8 +437,6 @@ class LoginView(BaseAppView): return self._get_template_context(c, **template_context) - @view_config(route_name='reset_password_confirmation', - request_method='GET') def password_reset_confirmation(self): self.load_default_context() if self.request.GET and self.request.GET.get('key'): diff --git a/rhodecode/apps/my_account/__init__.py b/rhodecode/apps/my_account/__init__.py --- a/rhodecode/apps/my_account/__init__.py +++ b/rhodecode/apps/my_account/__init__.py @@ -23,138 +23,311 @@ from rhodecode.apps._base import ADMIN_P def includeme(config): + from rhodecode.apps.my_account.views.my_account import MyAccountView + from rhodecode.apps.my_account.views.my_account_notifications import MyAccountNotificationsView + from rhodecode.apps.my_account.views.my_account_ssh_keys import MyAccountSshKeysView config.add_route( name='my_account_profile', pattern=ADMIN_PREFIX + '/my_account/profile') + config.add_view( + MyAccountView, + attr='my_account_profile', + route_name='my_account_profile', request_method='GET', + renderer='rhodecode:templates/admin/my_account/my_account.mako') # my account edit details config.add_route( name='my_account_edit', pattern=ADMIN_PREFIX + '/my_account/edit') + config.add_view( + MyAccountView, + attr='my_account_edit', + route_name='my_account_edit', + request_method='GET', + renderer='rhodecode:templates/admin/my_account/my_account.mako') + config.add_route( name='my_account_update', pattern=ADMIN_PREFIX + '/my_account/update') + config.add_view( + MyAccountView, + attr='my_account_update', + route_name='my_account_update', + request_method='POST', + renderer='rhodecode:templates/admin/my_account/my_account.mako') # my account password config.add_route( name='my_account_password', pattern=ADMIN_PREFIX + '/my_account/password') + config.add_view( + MyAccountView, + attr='my_account_password', + route_name='my_account_password', request_method='GET', + renderer='rhodecode:templates/admin/my_account/my_account.mako') config.add_route( name='my_account_password_update', pattern=ADMIN_PREFIX + '/my_account/password/update') + config.add_view( + MyAccountView, + attr='my_account_password_update', + route_name='my_account_password_update', request_method='POST', + renderer='rhodecode:templates/admin/my_account/my_account.mako') # my account tokens config.add_route( name='my_account_auth_tokens', pattern=ADMIN_PREFIX + '/my_account/auth_tokens') + config.add_view( + MyAccountView, + attr='my_account_auth_tokens', + route_name='my_account_auth_tokens', request_method='GET', + renderer='rhodecode:templates/admin/my_account/my_account.mako') + config.add_route( name='my_account_auth_tokens_view', pattern=ADMIN_PREFIX + '/my_account/auth_tokens/view') + config.add_view( + MyAccountView, + attr='my_account_auth_tokens_view', + route_name='my_account_auth_tokens_view', request_method='POST', xhr=True, + renderer='json_ext') + config.add_route( name='my_account_auth_tokens_add', pattern=ADMIN_PREFIX + '/my_account/auth_tokens/new') + config.add_view( + MyAccountView, + attr='my_account_auth_tokens_add', + route_name='my_account_auth_tokens_add', request_method='POST') + config.add_route( name='my_account_auth_tokens_delete', pattern=ADMIN_PREFIX + '/my_account/auth_tokens/delete') + config.add_view( + MyAccountView, + attr='my_account_auth_tokens_delete', + route_name='my_account_auth_tokens_delete', request_method='POST') # my account ssh keys config.add_route( name='my_account_ssh_keys', pattern=ADMIN_PREFIX + '/my_account/ssh_keys') + config.add_view( + MyAccountSshKeysView, + attr='my_account_ssh_keys', + route_name='my_account_ssh_keys', request_method='GET', + renderer='rhodecode:templates/admin/my_account/my_account.mako') + config.add_route( name='my_account_ssh_keys_generate', pattern=ADMIN_PREFIX + '/my_account/ssh_keys/generate') + config.add_view( + MyAccountSshKeysView, + attr='ssh_keys_generate_keypair', + route_name='my_account_ssh_keys_generate', request_method='GET', + renderer='rhodecode:templates/admin/my_account/my_account.mako') + config.add_route( name='my_account_ssh_keys_add', pattern=ADMIN_PREFIX + '/my_account/ssh_keys/new') + config.add_view( + MyAccountSshKeysView, + attr='my_account_ssh_keys_add', + route_name='my_account_ssh_keys_add', request_method='POST',) + config.add_route( name='my_account_ssh_keys_delete', pattern=ADMIN_PREFIX + '/my_account/ssh_keys/delete') + config.add_view( + MyAccountSshKeysView, + attr='my_account_ssh_keys_delete', + route_name='my_account_ssh_keys_delete', request_method='POST') # my account user group membership config.add_route( name='my_account_user_group_membership', pattern=ADMIN_PREFIX + '/my_account/user_group_membership') + config.add_view( + MyAccountView, + attr='my_account_user_group_membership', + route_name='my_account_user_group_membership', + request_method='GET', + renderer='rhodecode:templates/admin/my_account/my_account.mako') # my account emails config.add_route( name='my_account_emails', pattern=ADMIN_PREFIX + '/my_account/emails') + config.add_view( + MyAccountView, + attr='my_account_emails', + route_name='my_account_emails', request_method='GET', + renderer='rhodecode:templates/admin/my_account/my_account.mako') + config.add_route( name='my_account_emails_add', pattern=ADMIN_PREFIX + '/my_account/emails/new') + config.add_view( + MyAccountView, + attr='my_account_emails_add', + route_name='my_account_emails_add', request_method='POST', + renderer='rhodecode:templates/admin/my_account/my_account.mako') + config.add_route( name='my_account_emails_delete', pattern=ADMIN_PREFIX + '/my_account/emails/delete') + config.add_view( + MyAccountView, + attr='my_account_emails_delete', + route_name='my_account_emails_delete', request_method='POST') config.add_route( name='my_account_repos', pattern=ADMIN_PREFIX + '/my_account/repos') + config.add_view( + MyAccountView, + attr='my_account_repos', + route_name='my_account_repos', request_method='GET', + renderer='rhodecode:templates/admin/my_account/my_account.mako') config.add_route( name='my_account_watched', pattern=ADMIN_PREFIX + '/my_account/watched') + config.add_view( + MyAccountView, + attr='my_account_watched', + route_name='my_account_watched', request_method='GET', + renderer='rhodecode:templates/admin/my_account/my_account.mako') config.add_route( name='my_account_bookmarks', pattern=ADMIN_PREFIX + '/my_account/bookmarks') + config.add_view( + MyAccountView, + attr='my_account_bookmarks', + route_name='my_account_bookmarks', request_method='GET', + renderer='rhodecode:templates/admin/my_account/my_account.mako') config.add_route( name='my_account_bookmarks_update', pattern=ADMIN_PREFIX + '/my_account/bookmarks/update') + config.add_view( + MyAccountView, + attr='my_account_bookmarks_update', + route_name='my_account_bookmarks_update', request_method='POST') config.add_route( name='my_account_goto_bookmark', pattern=ADMIN_PREFIX + '/my_account/bookmark/{bookmark_id}') + config.add_view( + MyAccountView, + attr='my_account_goto_bookmark', + route_name='my_account_goto_bookmark', request_method='GET', + renderer='rhodecode:templates/admin/my_account/my_account.mako') config.add_route( name='my_account_perms', pattern=ADMIN_PREFIX + '/my_account/perms') + config.add_view( + MyAccountView, + attr='my_account_perms', + route_name='my_account_perms', request_method='GET', + renderer='rhodecode:templates/admin/my_account/my_account.mako') config.add_route( name='my_account_notifications', pattern=ADMIN_PREFIX + '/my_account/notifications') + config.add_view( + MyAccountView, + attr='my_notifications', + route_name='my_account_notifications', request_method='GET', + renderer='rhodecode:templates/admin/my_account/my_account.mako') config.add_route( name='my_account_notifications_toggle_visibility', pattern=ADMIN_PREFIX + '/my_account/toggle_visibility') + config.add_view( + MyAccountView, + attr='my_notifications_toggle_visibility', + route_name='my_account_notifications_toggle_visibility', + request_method='POST', renderer='json_ext') # my account pull requests config.add_route( name='my_account_pullrequests', pattern=ADMIN_PREFIX + '/my_account/pull_requests') + config.add_view( + MyAccountView, + attr='my_account_pullrequests', + route_name='my_account_pullrequests', + request_method='GET', + renderer='rhodecode:templates/admin/my_account/my_account.mako') + config.add_route( name='my_account_pullrequests_data', pattern=ADMIN_PREFIX + '/my_account/pull_requests/data') + config.add_view( + MyAccountView, + attr='my_account_pullrequests_data', + route_name='my_account_pullrequests_data', + request_method='GET', renderer='json_ext') + + # channelstream test + config.add_route( + name='my_account_notifications_test_channelstream', + pattern=ADMIN_PREFIX + '/my_account/test_channelstream') + config.add_view( + MyAccountView, + attr='my_account_notifications_test_channelstream', + route_name='my_account_notifications_test_channelstream', + request_method='POST', renderer='json_ext') # notifications config.add_route( name='notifications_show_all', pattern=ADMIN_PREFIX + '/notifications') + config.add_view( + MyAccountNotificationsView, + attr='notifications_show_all', + route_name='notifications_show_all', request_method='GET', + renderer='rhodecode:templates/admin/notifications/notifications_show_all.mako') # notifications config.add_route( name='notifications_mark_all_read', - pattern=ADMIN_PREFIX + '/notifications/mark_all_read') + pattern=ADMIN_PREFIX + '/notifications_mark_all_read') + config.add_view( + MyAccountNotificationsView, + attr='notifications_mark_all_read', + route_name='notifications_mark_all_read', request_method='POST', + renderer='rhodecode:templates/admin/notifications/notifications_show_all.mako') config.add_route( name='notifications_show', pattern=ADMIN_PREFIX + '/notifications/{notification_id}') + config.add_view( + MyAccountNotificationsView, + attr='notifications_show', + route_name='notifications_show', request_method='GET', + renderer='rhodecode:templates/admin/notifications/notifications_show.mako') config.add_route( name='notifications_update', pattern=ADMIN_PREFIX + '/notifications/{notification_id}/update') + config.add_view( + MyAccountNotificationsView, + attr='notification_update', + route_name='notifications_update', request_method='POST', + renderer='json_ext') config.add_route( name='notifications_delete', pattern=ADMIN_PREFIX + '/notifications/{notification_id}/delete') - - # channelstream test - config.add_route( - name='my_account_notifications_test_channelstream', - pattern=ADMIN_PREFIX + '/my_account/test_channelstream') - - # Scan module for configuration decorators. - config.scan('.views', ignore='.tests') + config.add_view( + MyAccountNotificationsView, + attr='notification_delete', + route_name='notifications_delete', request_method='POST', + renderer='json_ext') diff --git a/rhodecode/apps/my_account/tests/test_my_account_notifications.py b/rhodecode/apps/my_account/tests/test_my_account_notifications.py --- a/rhodecode/apps/my_account/tests/test_my_account_notifications.py +++ b/rhodecode/apps/my_account/tests/test_my_account_notifications.py @@ -40,7 +40,7 @@ def route_path(name, params=None, **kwar base_url = { 'notifications_show_all': ADMIN_PREFIX + '/notifications', - 'notifications_mark_all_read': ADMIN_PREFIX + '/notifications/mark_all_read', + 'notifications_mark_all_read': ADMIN_PREFIX + '/notifications_mark_all_read', 'notifications_show': ADMIN_PREFIX + '/notifications/{notification_id}', 'notifications_update': ADMIN_PREFIX + '/notifications/{notification_id}/update', 'notifications_delete': ADMIN_PREFIX + '/notifications/{notification_id}/delete', @@ -60,6 +60,15 @@ class TestNotificationsController(TestCo Session().delete(inst) Session().commit() + def test_mark_all_read(self, user_util): + user = user_util.create_user(password='qweqwe') + self.log_user(user.username, 'qweqwe') + + self.app.post( + route_path('notifications_mark_all_read'), status=302, + params={'csrf_token': self.csrf_token} + ) + def test_show_all(self, user_util): user = user_util.create_user(password='qweqwe') user_id = user.user_id diff --git a/rhodecode/apps/my_account/views/my_account.py b/rhodecode/apps/my_account/views/my_account.py --- a/rhodecode/apps/my_account/views/my_account.py +++ b/rhodecode/apps/my_account/views/my_account.py @@ -26,7 +26,6 @@ import formencode import formencode.htmlfill import peppercorn from pyramid.httpexceptions import HTTPFound, HTTPNotFound -from pyramid.view import view_config from rhodecode.apps._base import BaseAppView, DataGridAppView from rhodecode import forms @@ -65,14 +64,10 @@ class MyAccountView(BaseAppView, DataGri c = self._get_local_tmpl_context() c.user = c.auth_user.get_instance() c.allow_scoped_tokens = self.ALLOW_SCOPED_TOKENS - return c @LoginRequired() @NotAnonymous() - @view_config( - route_name='my_account_profile', request_method='GET', - renderer='rhodecode:templates/admin/my_account/my_account.mako') def my_account_profile(self): c = self.load_default_context() c.active = 'profile' @@ -81,9 +76,75 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() - @view_config( - route_name='my_account_password', request_method='GET', - renderer='rhodecode:templates/admin/my_account/my_account.mako') + def my_account_edit(self): + c = self.load_default_context() + c.active = 'profile_edit' + c.extern_type = c.user.extern_type + c.extern_name = c.user.extern_name + + schema = user_schema.UserProfileSchema().bind( + username=c.user.username, user_emails=c.user.emails) + appstruct = { + 'username': c.user.username, + 'email': c.user.email, + 'firstname': c.user.firstname, + 'lastname': c.user.lastname, + 'description': c.user.description, + } + c.form = forms.RcForm( + schema, appstruct=appstruct, + action=h.route_path('my_account_update'), + buttons=(forms.buttons.save, forms.buttons.reset)) + + return self._get_template_context(c) + + @LoginRequired() + @NotAnonymous() + @CSRFRequired() + def my_account_update(self): + _ = self.request.translate + c = self.load_default_context() + c.active = 'profile_edit' + c.perm_user = c.auth_user + c.extern_type = c.user.extern_type + c.extern_name = c.user.extern_name + + schema = user_schema.UserProfileSchema().bind( + username=c.user.username, user_emails=c.user.emails) + form = forms.RcForm( + schema, buttons=(forms.buttons.save, forms.buttons.reset)) + + controls = self.request.POST.items() + try: + valid_data = form.validate(controls) + skip_attrs = ['admin', 'active', 'extern_type', 'extern_name', + 'new_password', 'password_confirmation'] + if c.extern_type != "rhodecode": + # forbid updating username for external accounts + skip_attrs.append('username') + old_email = c.user.email + UserModel().update_user( + self._rhodecode_user.user_id, skip_attrs=skip_attrs, + **valid_data) + if old_email != valid_data['email']: + old = UserEmailMap.query() \ + .filter(UserEmailMap.user == c.user)\ + .filter(UserEmailMap.email == valid_data['email'])\ + .first() + old.email = old_email + h.flash(_('Your account was updated successfully'), category='success') + Session().commit() + except forms.ValidationFailure as e: + c.form = e + return self._get_template_context(c) + except Exception: + log.exception("Exception updating user") + h.flash(_('Error occurred during update of user'), + category='error') + raise HTTPFound(h.route_path('my_account_profile')) + + @LoginRequired() + @NotAnonymous() def my_account_password(self): c = self.load_default_context() c.active = 'password' @@ -103,9 +164,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() @CSRFRequired() - @view_config( - route_name='my_account_password_update', request_method='POST', - renderer='rhodecode:templates/admin/my_account/my_account.mako') def my_account_password_update(self): _ = self.request.translate c = self.load_default_context() @@ -146,9 +204,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() - @view_config( - route_name='my_account_auth_tokens', request_method='GET', - renderer='rhodecode:templates/admin/my_account/my_account.mako') def my_account_auth_tokens(self): _ = self.request.translate @@ -167,9 +222,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() @CSRFRequired() - @view_config( - route_name='my_account_auth_tokens_view', request_method='POST', xhr=True, - renderer='json_ext') def my_account_auth_tokens_view(self): _ = self.request.translate c = self.load_default_context() @@ -192,8 +244,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() @CSRFRequired() - @view_config( - route_name='my_account_auth_tokens_add', request_method='POST',) def my_account_auth_tokens_add(self): _ = self.request.translate c = self.load_default_context() @@ -220,8 +270,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() @CSRFRequired() - @view_config( - route_name='my_account_auth_tokens_delete', request_method='POST') def my_account_auth_tokens_delete(self): _ = self.request.translate c = self.load_default_context() @@ -244,9 +292,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() - @view_config( - route_name='my_account_emails', request_method='GET', - renderer='rhodecode:templates/admin/my_account/my_account.mako') def my_account_emails(self): _ = self.request.translate @@ -269,9 +314,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() @CSRFRequired() - @view_config( - route_name='my_account_emails_add', request_method='POST', - renderer='rhodecode:templates/admin/my_account/my_account.mako') def my_account_emails_add(self): _ = self.request.translate c = self.load_default_context() @@ -312,8 +354,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() @CSRFRequired() - @view_config( - route_name='my_account_emails_delete', request_method='POST') def my_account_emails_delete(self): _ = self.request.translate c = self.load_default_context() @@ -334,9 +374,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() @CSRFRequired() - @view_config( - route_name='my_account_notifications_test_channelstream', - request_method='POST', renderer='json_ext') def my_account_notifications_test_channelstream(self): message = 'Test message sent via Channelstream by user: {}, on {}'.format( self._rhodecode_user.username, datetime.datetime.now()) @@ -424,9 +461,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() - @view_config( - route_name='my_account_repos', request_method='GET', - renderer='rhodecode:templates/admin/my_account/my_account.mako') def my_account_repos(self): c = self.load_default_context() c.active = 'repos' @@ -437,9 +471,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() - @view_config( - route_name='my_account_watched', request_method='GET', - renderer='rhodecode:templates/admin/my_account/my_account.mako') def my_account_watched(self): c = self.load_default_context() c.active = 'watched' @@ -450,9 +481,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() - @view_config( - route_name='my_account_bookmarks', request_method='GET', - renderer='rhodecode:templates/admin/my_account/my_account.mako') def my_account_bookmarks(self): c = self.load_default_context() c.active = 'bookmarks' @@ -519,8 +547,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() @CSRFRequired() - @view_config( - route_name='my_account_bookmarks_update', request_method='POST') def my_account_bookmarks_update(self): _ = self.request.translate c = self.load_default_context() @@ -559,9 +585,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() - @view_config( - route_name='my_account_goto_bookmark', request_method='GET', - renderer='rhodecode:templates/admin/my_account/my_account.mako') def my_account_goto_bookmark(self): bookmark_id = self.request.matchdict['bookmark_id'] @@ -606,9 +629,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() - @view_config( - route_name='my_account_perms', request_method='GET', - renderer='rhodecode:templates/admin/my_account/my_account.mako') def my_account_perms(self): c = self.load_default_context() c.active = 'perms' @@ -618,9 +638,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() - @view_config( - route_name='my_account_notifications', request_method='GET', - renderer='rhodecode:templates/admin/my_account/my_account.mako') def my_notifications(self): c = self.load_default_context() c.active = 'notifications' @@ -630,9 +647,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() @CSRFRequired() - @view_config( - route_name='my_account_notifications_toggle_visibility', - request_method='POST', renderer='json_ext') def my_notifications_toggle_visibility(self): user = self._rhodecode_db_user new_status = not user.user_data.get('notification_status', True) @@ -640,83 +654,6 @@ class MyAccountView(BaseAppView, DataGri Session().commit() return user.user_data['notification_status'] - @LoginRequired() - @NotAnonymous() - @view_config( - route_name='my_account_edit', - request_method='GET', - renderer='rhodecode:templates/admin/my_account/my_account.mako') - def my_account_edit(self): - c = self.load_default_context() - c.active = 'profile_edit' - c.extern_type = c.user.extern_type - c.extern_name = c.user.extern_name - - schema = user_schema.UserProfileSchema().bind( - username=c.user.username, user_emails=c.user.emails) - appstruct = { - 'username': c.user.username, - 'email': c.user.email, - 'firstname': c.user.firstname, - 'lastname': c.user.lastname, - 'description': c.user.description, - } - c.form = forms.RcForm( - schema, appstruct=appstruct, - action=h.route_path('my_account_update'), - buttons=(forms.buttons.save, forms.buttons.reset)) - - return self._get_template_context(c) - - @LoginRequired() - @NotAnonymous() - @CSRFRequired() - @view_config( - route_name='my_account_update', - request_method='POST', - renderer='rhodecode:templates/admin/my_account/my_account.mako') - def my_account_update(self): - _ = self.request.translate - c = self.load_default_context() - c.active = 'profile_edit' - c.perm_user = c.auth_user - c.extern_type = c.user.extern_type - c.extern_name = c.user.extern_name - - schema = user_schema.UserProfileSchema().bind( - username=c.user.username, user_emails=c.user.emails) - form = forms.RcForm( - schema, buttons=(forms.buttons.save, forms.buttons.reset)) - - controls = self.request.POST.items() - try: - valid_data = form.validate(controls) - skip_attrs = ['admin', 'active', 'extern_type', 'extern_name', - 'new_password', 'password_confirmation'] - if c.extern_type != "rhodecode": - # forbid updating username for external accounts - skip_attrs.append('username') - old_email = c.user.email - UserModel().update_user( - self._rhodecode_user.user_id, skip_attrs=skip_attrs, - **valid_data) - if old_email != valid_data['email']: - old = UserEmailMap.query() \ - .filter(UserEmailMap.user == c.user)\ - .filter(UserEmailMap.email == valid_data['email'])\ - .first() - old.email = old_email - h.flash(_('Your account was updated successfully'), category='success') - Session().commit() - except forms.ValidationFailure as e: - c.form = e - return self._get_template_context(c) - except Exception: - log.exception("Exception updating user") - h.flash(_('Error occurred during update of user'), - category='error') - raise HTTPFound(h.route_path('my_account_profile')) - def _get_pull_requests_list(self, statuses): draw, start, limit = self._extract_chunk(self.request) search_q, order_by, order_dir = self._extract_ordering(self.request) @@ -781,10 +718,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() - @view_config( - route_name='my_account_pullrequests', - request_method='GET', - renderer='rhodecode:templates/admin/my_account/my_account.mako') def my_account_pullrequests(self): c = self.load_default_context() c.active = 'pullrequests' @@ -796,9 +729,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() - @view_config( - route_name='my_account_pullrequests_data', - request_method='GET', renderer='json_ext') def my_account_pullrequests_data(self): self.load_default_context() req_get = self.request.GET @@ -813,10 +743,6 @@ class MyAccountView(BaseAppView, DataGri @LoginRequired() @NotAnonymous() - @view_config( - route_name='my_account_user_group_membership', - request_method='GET', - renderer='rhodecode:templates/admin/my_account/my_account.mako') def my_account_user_group_membership(self): c = self.load_default_context() c.active = 'user_group_membership' diff --git a/rhodecode/apps/my_account/views/my_account_notifications.py b/rhodecode/apps/my_account/views/my_account_notifications.py --- a/rhodecode/apps/my_account/views/my_account_notifications.py +++ b/rhodecode/apps/my_account/views/my_account_notifications.py @@ -22,7 +22,6 @@ import logging from pyramid.httpexceptions import ( HTTPFound, HTTPNotFound, HTTPInternalServerError) -from pyramid.view import view_config from rhodecode.apps._base import BaseAppView from rhodecode.lib.auth import LoginRequired, NotAnonymous, CSRFRequired @@ -57,9 +56,6 @@ class MyAccountNotificationsView(BaseApp @LoginRequired() @NotAnonymous() - @view_config( - route_name='notifications_show_all', request_method='GET', - renderer='rhodecode:templates/admin/notifications/notifications_show_all.mako') def notifications_show_all(self): c = self.load_default_context() @@ -105,22 +101,6 @@ class MyAccountNotificationsView(BaseApp @LoginRequired() @NotAnonymous() - @CSRFRequired() - @view_config( - route_name='notifications_mark_all_read', request_method='POST', - renderer='rhodecode:templates/admin/notifications/notifications_show_all.mako') - def notifications_mark_all_read(self): - NotificationModel().mark_all_read_for_user( - self._rhodecode_db_user.user_id, - filter_=self.request.GET.getall('type')) - Session().commit() - raise HTTPFound(h.route_path('notifications_show_all')) - - @LoginRequired() - @NotAnonymous() - @view_config( - route_name='notifications_show', request_method='GET', - renderer='rhodecode:templates/admin/notifications/notifications_show.mako') def notifications_show(self): c = self.load_default_context() notification_id = self.request.matchdict['notification_id'] @@ -150,9 +130,16 @@ class MyAccountNotificationsView(BaseApp @LoginRequired() @NotAnonymous() @CSRFRequired() - @view_config( - route_name='notifications_update', request_method='POST', - renderer='json_ext') + def notifications_mark_all_read(self): + NotificationModel().mark_all_read_for_user( + self._rhodecode_db_user.user_id, + filter_=self.request.GET.getall('type')) + Session().commit() + raise HTTPFound(h.route_path('notifications_show_all')) + + @LoginRequired() + @NotAnonymous() + @CSRFRequired() def notification_update(self): notification_id = self.request.matchdict['notification_id'] notification = Notification.get_or_404(notification_id) @@ -177,9 +164,6 @@ class MyAccountNotificationsView(BaseApp @LoginRequired() @NotAnonymous() @CSRFRequired() - @view_config( - route_name='notifications_delete', request_method='POST', - renderer='json_ext') def notification_delete(self): notification_id = self.request.matchdict['notification_id'] notification = Notification.get_or_404(notification_id) diff --git a/rhodecode/apps/my_account/views/my_account_ssh_keys.py b/rhodecode/apps/my_account/views/my_account_ssh_keys.py --- a/rhodecode/apps/my_account/views/my_account_ssh_keys.py +++ b/rhodecode/apps/my_account/views/my_account_ssh_keys.py @@ -21,7 +21,6 @@ import logging from pyramid.httpexceptions import HTTPFound -from pyramid.view import view_config from rhodecode.apps._base import BaseAppView, DataGridAppView from rhodecode.apps.ssh_support import SshKeyFileChangeEvent @@ -41,17 +40,12 @@ class MyAccountSshKeysView(BaseAppView, def load_default_context(self): c = self._get_local_tmpl_context() c.user = c.auth_user.get_instance() - c.ssh_enabled = self.request.registry.settings.get( 'ssh.generate_authorized_keyfile') - return c @LoginRequired() @NotAnonymous() - @view_config( - route_name='my_account_ssh_keys', request_method='GET', - renderer='rhodecode:templates/admin/my_account/my_account.mako') def my_account_ssh_keys(self): _ = self.request.translate @@ -63,9 +57,6 @@ class MyAccountSshKeysView(BaseAppView, @LoginRequired() @NotAnonymous() - @view_config( - route_name='my_account_ssh_keys_generate', request_method='GET', - renderer='rhodecode:templates/admin/my_account/my_account.mako') def ssh_keys_generate_keypair(self): _ = self.request.translate c = self.load_default_context() @@ -84,8 +75,6 @@ class MyAccountSshKeysView(BaseAppView, @LoginRequired() @NotAnonymous() @CSRFRequired() - @view_config( - route_name='my_account_ssh_keys_add', request_method='POST',) def my_account_ssh_keys_add(self): _ = self.request.translate c = self.load_default_context() @@ -132,8 +121,6 @@ class MyAccountSshKeysView(BaseAppView, @LoginRequired() @NotAnonymous() @CSRFRequired() - @view_config( - route_name='my_account_ssh_keys_delete', request_method='POST') def my_account_ssh_keys_delete(self): _ = self.request.translate c = self.load_default_context() diff --git a/rhodecode/apps/ops/__init__.py b/rhodecode/apps/ops/__init__.py --- a/rhodecode/apps/ops/__init__.py +++ b/rhodecode/apps/ops/__init__.py @@ -22,25 +22,35 @@ from rhodecode.apps._base import ADMIN_P def admin_routes(config): + from rhodecode.apps.ops.views import OpsView + config.add_route( name='ops_ping', pattern='/ping') + config.add_view( + OpsView, + attr='ops_ping', + route_name='ops_ping', request_method='GET', + renderer='json_ext') + config.add_route( name='ops_error_test', pattern='/error') + config.add_view( + OpsView, + attr='ops_error_test', + route_name='ops_error_test', request_method='GET', + renderer='json_ext') + config.add_route( name='ops_redirect_test', pattern='/redirect') + config.add_view( + OpsView, + attr='ops_redirect_test', + route_name='ops_redirect_test', request_method='GET', + renderer='json_ext') def includeme(config): - config.include(admin_routes, route_prefix=ADMIN_PREFIX + '/ops') - # make OLD entries from <4.10.0 work - config.add_route( - name='ops_ping_legacy', pattern=ADMIN_PREFIX + '/ping') - config.add_route( - name='ops_error_test_legacy', pattern=ADMIN_PREFIX + '/error_test') - - # Scan module for configuration decorators. - config.scan('.views', ignore='.tests') diff --git a/rhodecode/apps/ops/views.py b/rhodecode/apps/ops/views.py --- a/rhodecode/apps/ops/views.py +++ b/rhodecode/apps/ops/views.py @@ -21,7 +21,7 @@ import time import logging -from pyramid.view import view_config + from pyramid.httpexceptions import HTTPFound from rhodecode.apps._base import BaseAppView @@ -38,12 +38,6 @@ class OpsView(BaseAppView): return c - @view_config( - route_name='ops_ping', request_method='GET', - renderer='json_ext') - @view_config( - route_name='ops_ping_legacy', request_method='GET', - renderer='json_ext') def ops_ping(self): data = { 'instance': self.request.registry.settings.get('instance_id'), @@ -59,12 +53,6 @@ class OpsView(BaseAppView): }) return {'ok': data} - @view_config( - route_name='ops_error_test', request_method='GET', - renderer='json_ext') - @view_config( - route_name='ops_error_test_legacy', request_method='GET', - renderer='json_ext') def ops_error_test(self): """ Test exception handling and emails on errors @@ -78,9 +66,6 @@ class OpsView(BaseAppView): 'Client:{}. Generation time: {}.'.format(self.request.user, time.time())) raise TestException(msg) - @view_config( - route_name='ops_redirect_test', request_method='GET', - renderer='json_ext') def ops_redirect_test(self): """ Test redirect handling diff --git a/rhodecode/apps/repo_group/__init__.py b/rhodecode/apps/repo_group/__init__.py --- a/rhodecode/apps/repo_group/__init__.py +++ b/rhodecode/apps/repo_group/__init__.py @@ -18,6 +18,10 @@ # RhodeCode Enterprise Edition, including its added features, Support services, # and proprietary license terms, please see https://rhodecode.com/licenses/ from rhodecode.apps._base import add_route_with_slash +from rhodecode.apps.repo_group.views.repo_group_settings import RepoGroupSettingsView +from rhodecode.apps.repo_group.views.repo_group_advanced import RepoGroupAdvancedSettingsView +from rhodecode.apps.repo_group.views.repo_group_permissions import RepoGroupPermissionsView +from rhodecode.apps.home.views import HomeView def includeme(config): @@ -27,35 +31,72 @@ def includeme(config): name='edit_repo_group', pattern='/{repo_group_name:.*?[^/]}/_edit', repo_group_route=True) - # update is POST on edit_repo_group + config.add_view( + RepoGroupSettingsView, + attr='edit_settings', + route_name='edit_repo_group', request_method='GET', + renderer='rhodecode:templates/admin/repo_groups/repo_group_edit.mako') + config.add_view( + RepoGroupSettingsView, + attr='edit_settings_update', + route_name='edit_repo_group', request_method='POST', + renderer='rhodecode:templates/admin/repo_groups/repo_group_edit.mako') # Settings advanced config.add_route( name='edit_repo_group_advanced', pattern='/{repo_group_name:.*?[^/]}/_settings/advanced', repo_group_route=True) + config.add_view( + RepoGroupAdvancedSettingsView, + attr='edit_repo_group_advanced', + route_name='edit_repo_group_advanced', request_method='GET', + renderer='rhodecode:templates/admin/repo_groups/repo_group_edit.mako') config.add_route( name='edit_repo_group_advanced_delete', pattern='/{repo_group_name:.*?[^/]}/_settings/advanced/delete', repo_group_route=True) + config.add_view( + RepoGroupAdvancedSettingsView, + attr='edit_repo_group_delete', + route_name='edit_repo_group_advanced_delete', request_method='POST', + renderer='rhodecode:templates/admin/repo_groups/repo_group_edit.mako') # settings permissions config.add_route( name='edit_repo_group_perms', pattern='/{repo_group_name:.*?[^/]}/_settings/permissions', repo_group_route=True) + config.add_view( + RepoGroupPermissionsView, + attr='edit_repo_group_permissions', + route_name='edit_repo_group_perms', request_method='GET', + renderer='rhodecode:templates/admin/repo_groups/repo_group_edit.mako') config.add_route( name='edit_repo_group_perms_update', pattern='/{repo_group_name:.*?[^/]}/_settings/permissions/update', repo_group_route=True) + config.add_view( + RepoGroupPermissionsView, + attr='edit_repo_groups_permissions_update', + route_name='edit_repo_group_perms_update', request_method='POST', + renderer='rhodecode:templates/admin/repo_groups/repo_group_edit.mako') # Summary, NOTE(marcink): needs to be at the end for catch-all add_route_with_slash( config, name='repo_group_home', pattern='/{repo_group_name:.*?[^/]}', repo_group_route=True) + config.add_view( + HomeView, + attr='repo_group_main_page', + route_name='repo_group_home', request_method='GET', + renderer='rhodecode:templates/index_repo_group.mako') + config.add_view( + HomeView, + attr='repo_group_main_page', + route_name='repo_group_home_slash', request_method='GET', + renderer='rhodecode:templates/index_repo_group.mako') - # Scan module for configuration decorators. - config.scan('.views', ignore='.tests') diff --git a/rhodecode/apps/repo_group/views/repo_group_advanced.py b/rhodecode/apps/repo_group/views/repo_group_advanced.py --- a/rhodecode/apps/repo_group/views/repo_group_advanced.py +++ b/rhodecode/apps/repo_group/views/repo_group_advanced.py @@ -20,7 +20,7 @@ import logging -from pyramid.view import view_config + from pyramid.httpexceptions import HTTPFound from rhodecode.apps._base import RepoGroupAppView @@ -34,17 +34,13 @@ from rhodecode.model.meta import Session log = logging.getLogger(__name__) -class RepoGroupSettingsView(RepoGroupAppView): +class RepoGroupAdvancedSettingsView(RepoGroupAppView): def load_default_context(self): c = self._get_local_tmpl_context() - return c @LoginRequired() @HasRepoGroupPermissionAnyDecorator('group.admin') - @view_config( - route_name='edit_repo_group_advanced', request_method='GET', - renderer='rhodecode:templates/admin/repo_groups/repo_group_edit.mako') def edit_repo_group_advanced(self): _ = self.request.translate c = self.load_default_context() @@ -61,9 +57,6 @@ class RepoGroupSettingsView(RepoGroupApp @LoginRequired() @HasRepoGroupPermissionAnyDecorator('group.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_group_advanced_delete', request_method='POST', - renderer='rhodecode:templates/admin/repo_groups/repo_group_edit.mako') def edit_repo_group_delete(self): _ = self.request.translate _ungettext = self.request.plularize diff --git a/rhodecode/apps/repo_group/views/repo_group_permissions.py b/rhodecode/apps/repo_group/views/repo_group_permissions.py --- a/rhodecode/apps/repo_group/views/repo_group_permissions.py +++ b/rhodecode/apps/repo_group/views/repo_group_permissions.py @@ -20,7 +20,7 @@ import logging -from pyramid.view import view_config + from pyramid.httpexceptions import HTTPFound from rhodecode.apps._base import RepoGroupAppView @@ -45,9 +45,6 @@ class RepoGroupPermissionsView(RepoGroup @LoginRequired() @HasRepoGroupPermissionAnyDecorator('group.admin') - @view_config( - route_name='edit_repo_group_perms', request_method='GET', - renderer='rhodecode:templates/admin/repo_groups/repo_group_edit.mako') def edit_repo_group_permissions(self): c = self.load_default_context() c.active = 'permissions' @@ -57,9 +54,6 @@ class RepoGroupPermissionsView(RepoGroup @LoginRequired() @HasRepoGroupPermissionAnyDecorator('group.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_group_perms_update', request_method='POST', - renderer='rhodecode:templates/admin/repo_groups/repo_group_edit.mako') def edit_repo_groups_permissions_update(self): _ = self.request.translate c = self.load_default_context() diff --git a/rhodecode/apps/repo_group/views/repo_group_settings.py b/rhodecode/apps/repo_group/views/repo_group_settings.py --- a/rhodecode/apps/repo_group/views/repo_group_settings.py +++ b/rhodecode/apps/repo_group/views/repo_group_settings.py @@ -21,7 +21,7 @@ import logging import deform -from pyramid.view import view_config + from pyramid.httpexceptions import HTTPFound from rhodecode import events @@ -109,9 +109,6 @@ class RepoGroupSettingsView(RepoGroupApp @LoginRequired() @HasRepoGroupPermissionAnyDecorator('group.admin') - @view_config( - route_name='edit_repo_group', request_method='GET', - renderer='rhodecode:templates/admin/repo_groups/repo_group_edit.mako') def edit_settings(self): c = self.load_default_context() c.active = 'settings' @@ -126,9 +123,6 @@ class RepoGroupSettingsView(RepoGroupApp @LoginRequired() @HasRepoGroupPermissionAnyDecorator('group.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_group', request_method='POST', - renderer='rhodecode:templates/admin/repo_groups/repo_group_edit.mako') def edit_settings_update(self): _ = self.request.translate c = self.load_default_context() diff --git a/rhodecode/apps/repository/__init__.py b/rhodecode/apps/repository/__init__.py --- a/rhodecode/apps/repository/__init__.py +++ b/rhodecode/apps/repository/__init__.py @@ -21,15 +21,52 @@ from rhodecode.apps._base import add_rou def includeme(config): + from rhodecode.apps.repository.views.repo_artifacts import RepoArtifactsView + from rhodecode.apps.repository.views.repo_audit_logs import AuditLogsView + from rhodecode.apps.repository.views.repo_automation import RepoAutomationView + from rhodecode.apps.repository.views.repo_bookmarks import RepoBookmarksView + from rhodecode.apps.repository.views.repo_branch_permissions import RepoSettingsBranchPermissionsView + from rhodecode.apps.repository.views.repo_branches import RepoBranchesView + from rhodecode.apps.repository.views.repo_caches import RepoCachesView + from rhodecode.apps.repository.views.repo_changelog import RepoChangelogView + from rhodecode.apps.repository.views.repo_checks import RepoChecksView + from rhodecode.apps.repository.views.repo_commits import RepoCommitsView + from rhodecode.apps.repository.views.repo_compare import RepoCompareView + from rhodecode.apps.repository.views.repo_feed import RepoFeedView + from rhodecode.apps.repository.views.repo_files import RepoFilesView + from rhodecode.apps.repository.views.repo_forks import RepoForksView + from rhodecode.apps.repository.views.repo_maintainance import RepoMaintenanceView + from rhodecode.apps.repository.views.repo_permissions import RepoSettingsPermissionsView + from rhodecode.apps.repository.views.repo_pull_requests import RepoPullRequestsView + from rhodecode.apps.repository.views.repo_review_rules import RepoReviewRulesView + from rhodecode.apps.repository.views.repo_settings import RepoSettingsView + from rhodecode.apps.repository.views.repo_settings_advanced import RepoSettingsAdvancedView + from rhodecode.apps.repository.views.repo_settings_fields import RepoSettingsFieldsView + from rhodecode.apps.repository.views.repo_settings_issue_trackers import RepoSettingsIssueTrackersView + from rhodecode.apps.repository.views.repo_settings_remote import RepoSettingsRemoteView + from rhodecode.apps.repository.views.repo_settings_vcs import RepoSettingsVcsView + from rhodecode.apps.repository.views.repo_strip import RepoStripView + from rhodecode.apps.repository.views.repo_summary import RepoSummaryView + from rhodecode.apps.repository.views.repo_tags import RepoTagsView # repo creating checks, special cases that aren't repo routes config.add_route( name='repo_creating', pattern='/{repo_name:.*?[^/]}/repo_creating') + config.add_view( + RepoChecksView, + attr='repo_creating', + route_name='repo_creating', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_creating.mako') config.add_route( name='repo_creating_check', pattern='/{repo_name:.*?[^/]}/repo_creating_check') + config.add_view( + RepoChecksView, + attr='repo_creating_check', + route_name='repo_creating_check', request_method='GET', + renderer='json_ext') # Summary # NOTE(marcink): one additional route is defined in very bottom, catch @@ -37,191 +74,467 @@ def includeme(config): config.add_route( name='repo_summary_explicit', pattern='/{repo_name:.*?[^/]}/summary', repo_route=True) + config.add_view( + RepoSummaryView, + attr='summary', + route_name='repo_summary_explicit', request_method='GET', + renderer='rhodecode:templates/summary/summary.mako') + config.add_route( name='repo_summary_commits', pattern='/{repo_name:.*?[^/]}/summary-commits', repo_route=True) - + config.add_view( + RepoSummaryView, + attr='summary_commits', + route_name='repo_summary_commits', request_method='GET', + renderer='rhodecode:templates/summary/summary_commits.mako') + # Commits config.add_route( name='repo_commit', pattern='/{repo_name:.*?[^/]}/changeset/{commit_id}', repo_route=True) + config.add_view( + RepoCommitsView, + attr='repo_commit_show', + route_name='repo_commit', request_method='GET', + renderer=None) config.add_route( name='repo_commit_children', pattern='/{repo_name:.*?[^/]}/changeset_children/{commit_id}', repo_route=True) + config.add_view( + RepoCommitsView, + attr='repo_commit_children', + route_name='repo_commit_children', request_method='GET', + renderer='json_ext', xhr=True) config.add_route( name='repo_commit_parents', pattern='/{repo_name:.*?[^/]}/changeset_parents/{commit_id}', repo_route=True) + config.add_view( + RepoCommitsView, + attr='repo_commit_parents', + route_name='repo_commit_parents', request_method='GET', + renderer='json_ext') config.add_route( name='repo_commit_raw', pattern='/{repo_name:.*?[^/]}/changeset-diff/{commit_id}', repo_route=True) + config.add_view( + RepoCommitsView, + attr='repo_commit_raw', + route_name='repo_commit_raw', request_method='GET', + renderer=None) config.add_route( name='repo_commit_patch', pattern='/{repo_name:.*?[^/]}/changeset-patch/{commit_id}', repo_route=True) + config.add_view( + RepoCommitsView, + attr='repo_commit_patch', + route_name='repo_commit_patch', request_method='GET', + renderer=None) config.add_route( name='repo_commit_download', pattern='/{repo_name:.*?[^/]}/changeset-download/{commit_id}', repo_route=True) + config.add_view( + RepoCommitsView, + attr='repo_commit_download', + route_name='repo_commit_download', request_method='GET', + renderer=None) config.add_route( name='repo_commit_data', pattern='/{repo_name:.*?[^/]}/changeset-data/{commit_id}', repo_route=True) + config.add_view( + RepoCommitsView, + attr='repo_commit_data', + route_name='repo_commit_data', request_method='GET', + renderer='json_ext', xhr=True) config.add_route( name='repo_commit_comment_create', pattern='/{repo_name:.*?[^/]}/changeset/{commit_id}/comment/create', repo_route=True) + config.add_view( + RepoCommitsView, + attr='repo_commit_comment_create', + route_name='repo_commit_comment_create', request_method='POST', + renderer='json_ext') config.add_route( name='repo_commit_comment_preview', pattern='/{repo_name:.*?[^/]}/changeset/{commit_id}/comment/preview', repo_route=True) + config.add_view( + RepoCommitsView, + attr='repo_commit_comment_preview', + route_name='repo_commit_comment_preview', request_method='POST', + renderer='string', xhr=True) config.add_route( name='repo_commit_comment_history_view', pattern='/{repo_name:.*?[^/]}/changeset/{commit_id}/comment/{comment_history_id}/history_view', repo_route=True) + config.add_view( + RepoCommitsView, + attr='repo_commit_comment_history_view', + route_name='repo_commit_comment_history_view', request_method='POST', + renderer='string', xhr=True) config.add_route( name='repo_commit_comment_attachment_upload', pattern='/{repo_name:.*?[^/]}/changeset/{commit_id}/comment/attachment_upload', repo_route=True) + config.add_view( + RepoCommitsView, + attr='repo_commit_comment_attachment_upload', + route_name='repo_commit_comment_attachment_upload', request_method='POST', + renderer='json_ext', xhr=True) config.add_route( name='repo_commit_comment_delete', pattern='/{repo_name:.*?[^/]}/changeset/{commit_id}/comment/{comment_id}/delete', repo_route=True) + config.add_view( + RepoCommitsView, + attr='repo_commit_comment_delete', + route_name='repo_commit_comment_delete', request_method='POST', + renderer='json_ext') config.add_route( name='repo_commit_comment_edit', pattern='/{repo_name:.*?[^/]}/changeset/{commit_id}/comment/{comment_id}/edit', repo_route=True) + config.add_view( + RepoCommitsView, + attr='repo_commit_comment_edit', + route_name='repo_commit_comment_edit', request_method='POST', + renderer='json_ext') # still working url for backward compat. config.add_route( name='repo_commit_raw_deprecated', pattern='/{repo_name:.*?[^/]}/raw-changeset/{commit_id}', repo_route=True) + config.add_view( + RepoCommitsView, + attr='repo_commit_raw', + route_name='repo_commit_raw_deprecated', request_method='GET', + renderer=None) # Files config.add_route( name='repo_archivefile', pattern='/{repo_name:.*?[^/]}/archive/{fname:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_archivefile', + route_name='repo_archivefile', request_method='GET', + renderer=None) config.add_route( name='repo_files_diff', pattern='/{repo_name:.*?[^/]}/diff/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_files_diff', + route_name='repo_files_diff', request_method='GET', + renderer=None) + config.add_route( # legacy route to make old links work name='repo_files_diff_2way_redirect', pattern='/{repo_name:.*?[^/]}/diff-2way/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_files_diff_2way_redirect', + route_name='repo_files_diff_2way_redirect', request_method='GET', + renderer=None) config.add_route( name='repo_files', pattern='/{repo_name:.*?[^/]}/files/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_files', + route_name='repo_files', request_method='GET', + renderer=None) + config.add_route( name='repo_files:default_path', pattern='/{repo_name:.*?[^/]}/files/{commit_id}/', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_files', + route_name='repo_files:default_path', request_method='GET', + renderer=None) + config.add_route( name='repo_files:default_commit', pattern='/{repo_name:.*?[^/]}/files', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_files', + route_name='repo_files:default_commit', request_method='GET', + renderer=None) config.add_route( name='repo_files:rendered', pattern='/{repo_name:.*?[^/]}/render/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_files', + route_name='repo_files:rendered', request_method='GET', + renderer=None) config.add_route( name='repo_files:annotated', pattern='/{repo_name:.*?[^/]}/annotate/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_files', + route_name='repo_files:annotated', request_method='GET', + renderer=None) + config.add_route( name='repo_files:annotated_previous', pattern='/{repo_name:.*?[^/]}/annotate-previous/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_files_annotated_previous', + route_name='repo_files:annotated_previous', request_method='GET', + renderer=None) config.add_route( name='repo_nodetree_full', pattern='/{repo_name:.*?[^/]}/nodetree_full/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_nodetree_full', + route_name='repo_nodetree_full', request_method='GET', + renderer=None, xhr=True) + config.add_route( name='repo_nodetree_full:default_path', pattern='/{repo_name:.*?[^/]}/nodetree_full/{commit_id}/', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_nodetree_full', + route_name='repo_nodetree_full:default_path', request_method='GET', + renderer=None, xhr=True) config.add_route( name='repo_files_nodelist', pattern='/{repo_name:.*?[^/]}/nodelist/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_nodelist', + route_name='repo_files_nodelist', request_method='GET', + renderer='json_ext', xhr=True) config.add_route( name='repo_file_raw', pattern='/{repo_name:.*?[^/]}/raw/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_file_raw', + route_name='repo_file_raw', request_method='GET', + renderer=None) config.add_route( name='repo_file_download', pattern='/{repo_name:.*?[^/]}/download/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_file_download', + route_name='repo_file_download', request_method='GET', + renderer=None) + config.add_route( # backward compat to keep old links working name='repo_file_download:legacy', pattern='/{repo_name:.*?[^/]}/rawfile/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_file_download', + route_name='repo_file_download:legacy', request_method='GET', + renderer=None) config.add_route( name='repo_file_history', pattern='/{repo_name:.*?[^/]}/history/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_file_history', + route_name='repo_file_history', request_method='GET', + renderer='json_ext') config.add_route( name='repo_file_authors', pattern='/{repo_name:.*?[^/]}/authors/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_file_authors', + route_name='repo_file_authors', request_method='GET', + renderer='rhodecode:templates/files/file_authors_box.mako') config.add_route( name='repo_files_check_head', pattern='/{repo_name:.*?[^/]}/check_head/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_files_check_head', + route_name='repo_files_check_head', request_method='POST', + renderer='json_ext', xhr=True) + config.add_route( name='repo_files_remove_file', pattern='/{repo_name:.*?[^/]}/remove_file/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_files_remove_file', + route_name='repo_files_remove_file', request_method='GET', + renderer='rhodecode:templates/files/files_delete.mako') + config.add_route( name='repo_files_delete_file', pattern='/{repo_name:.*?[^/]}/delete_file/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_files_delete_file', + route_name='repo_files_delete_file', request_method='POST', + renderer=None) + config.add_route( name='repo_files_edit_file', pattern='/{repo_name:.*?[^/]}/edit_file/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_files_edit_file', + route_name='repo_files_edit_file', request_method='GET', + renderer='rhodecode:templates/files/files_edit.mako') + config.add_route( name='repo_files_update_file', pattern='/{repo_name:.*?[^/]}/update_file/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_files_update_file', + route_name='repo_files_update_file', request_method='POST', + renderer=None) + config.add_route( name='repo_files_add_file', pattern='/{repo_name:.*?[^/]}/add_file/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_files_add_file', + route_name='repo_files_add_file', request_method='GET', + renderer='rhodecode:templates/files/files_add.mako') + config.add_route( name='repo_files_upload_file', pattern='/{repo_name:.*?[^/]}/upload_file/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoFilesView, + attr='repo_files_add_file', + route_name='repo_files_upload_file', request_method='GET', + renderer='rhodecode:templates/files/files_upload.mako') + config.add_view( # POST creates + RepoFilesView, + attr='repo_files_upload_file', + route_name='repo_files_upload_file', request_method='POST', + renderer='json_ext') + config.add_route( name='repo_files_create_file', pattern='/{repo_name:.*?[^/]}/create_file/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( # POST creates + RepoFilesView, + attr='repo_files_create_file', + route_name='repo_files_create_file', request_method='POST', + renderer=None) # Refs data config.add_route( name='repo_refs_data', pattern='/{repo_name:.*?[^/]}/refs-data', repo_route=True) + config.add_view( + RepoSummaryView, + attr='repo_refs_data', + route_name='repo_refs_data', request_method='GET', + renderer='json_ext') config.add_route( name='repo_refs_changelog_data', pattern='/{repo_name:.*?[^/]}/refs-data-changelog', repo_route=True) + config.add_view( + RepoSummaryView, + attr='repo_refs_changelog_data', + route_name='repo_refs_changelog_data', request_method='GET', + renderer='json_ext') config.add_route( name='repo_stats', pattern='/{repo_name:.*?[^/]}/repo_stats/{commit_id}', repo_route=True) + config.add_view( + RepoSummaryView, + attr='repo_stats', + route_name='repo_stats', request_method='GET', + renderer='json_ext') # Commits config.add_route( name='repo_commits', pattern='/{repo_name:.*?[^/]}/commits', repo_route=True) + config.add_view( + RepoChangelogView, + attr='repo_changelog', + route_name='repo_commits', request_method='GET', + renderer='rhodecode:templates/commits/changelog.mako') + # old routes for backward compat + config.add_view( + RepoChangelogView, + attr='repo_changelog', + route_name='repo_changelog', request_method='GET', + renderer='rhodecode:templates/commits/changelog.mako') + + config.add_route( + name='repo_commits_elements', + pattern='/{repo_name:.*?[^/]}/commits_elements', repo_route=True) + config.add_view( + RepoChangelogView, + attr='repo_commits_elements', + route_name='repo_commits_elements', request_method=('GET', 'POST'), + renderer='rhodecode:templates/commits/changelog_elements.mako', + xhr=True) + + config.add_route( + name='repo_commits_elements_file', + pattern='/{repo_name:.*?[^/]}/commits_elements/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoChangelogView, + attr='repo_commits_elements', + route_name='repo_commits_elements_file', request_method=('GET', 'POST'), + renderer='rhodecode:templates/commits/changelog_elements.mako', + xhr=True) + config.add_route( name='repo_commits_file', pattern='/{repo_name:.*?[^/]}/commits/{commit_id}/{f_path:.*}', repo_route=True) - config.add_route( - name='repo_commits_elements', - pattern='/{repo_name:.*?[^/]}/commits_elements', repo_route=True) - config.add_route( - name='repo_commits_elements_file', - pattern='/{repo_name:.*?[^/]}/commits_elements/{commit_id}/{f_path:.*}', repo_route=True) + config.add_view( + RepoChangelogView, + attr='repo_changelog', + route_name='repo_commits_file', request_method='GET', + renderer='rhodecode:templates/commits/changelog.mako') + # old routes for backward compat + config.add_view( + RepoChangelogView, + attr='repo_changelog', + route_name='repo_changelog_file', request_method='GET', + renderer='rhodecode:templates/commits/changelog.mako') # Changelog (old deprecated name for commits page) config.add_route( @@ -235,25 +548,50 @@ def includeme(config): config.add_route( name='repo_compare_select', pattern='/{repo_name:.*?[^/]}/compare', repo_route=True) + config.add_view( + RepoCompareView, + attr='compare_select', + route_name='repo_compare_select', request_method='GET', + renderer='rhodecode:templates/compare/compare_diff.mako') config.add_route( name='repo_compare', pattern='/{repo_name:.*?[^/]}/compare/{source_ref_type}@{source_ref:.*?}...{target_ref_type}@{target_ref:.*?}', repo_route=True) + config.add_view( + RepoCompareView, + attr='compare', + route_name='repo_compare', request_method='GET', + renderer=None) # Tags config.add_route( name='tags_home', pattern='/{repo_name:.*?[^/]}/tags', repo_route=True) + config.add_view( + RepoTagsView, + attr='tags', + route_name='tags_home', request_method='GET', + renderer='rhodecode:templates/tags/tags.mako') # Branches config.add_route( name='branches_home', pattern='/{repo_name:.*?[^/]}/branches', repo_route=True) + config.add_view( + RepoBranchesView, + attr='branches', + route_name='branches_home', request_method='GET', + renderer='rhodecode:templates/branches/branches.mako') # Bookmarks config.add_route( name='bookmarks_home', pattern='/{repo_name:.*?[^/]}/bookmarks', repo_route=True) + config.add_view( + RepoBookmarksView, + attr='bookmarks', + route_name='bookmarks_home', request_method='GET', + renderer='rhodecode:templates/bookmarks/bookmarks.mako') # Forks config.add_route( @@ -261,195 +599,426 @@ def includeme(config): pattern='/{repo_name:.*?[^/]}/fork', repo_route=True, repo_forbid_when_archived=True, repo_accepted_types=['hg', 'git']) + config.add_view( + RepoForksView, + attr='repo_fork_new', + route_name='repo_fork_new', request_method='GET', + renderer='rhodecode:templates/forks/forks.mako') config.add_route( name='repo_fork_create', pattern='/{repo_name:.*?[^/]}/fork/create', repo_route=True, repo_forbid_when_archived=True, repo_accepted_types=['hg', 'git']) + config.add_view( + RepoForksView, + attr='repo_fork_create', + route_name='repo_fork_create', request_method='POST', + renderer='rhodecode:templates/forks/fork.mako') config.add_route( name='repo_forks_show_all', pattern='/{repo_name:.*?[^/]}/forks', repo_route=True, repo_accepted_types=['hg', 'git']) + config.add_view( + RepoForksView, + attr='repo_forks_show_all', + route_name='repo_forks_show_all', request_method='GET', + renderer='rhodecode:templates/forks/forks.mako') + config.add_route( name='repo_forks_data', pattern='/{repo_name:.*?[^/]}/forks/data', repo_route=True, repo_accepted_types=['hg', 'git']) + config.add_view( + RepoForksView, + attr='repo_forks_data', + route_name='repo_forks_data', request_method='GET', + renderer='json_ext', xhr=True) # Pull Requests config.add_route( name='pullrequest_show', pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id:\d+}', repo_route=True) + config.add_view( + RepoPullRequestsView, + attr='pull_request_show', + route_name='pullrequest_show', request_method='GET', + renderer='rhodecode:templates/pullrequests/pullrequest_show.mako') config.add_route( name='pullrequest_show_all', pattern='/{repo_name:.*?[^/]}/pull-request', repo_route=True, repo_accepted_types=['hg', 'git']) + config.add_view( + RepoPullRequestsView, + attr='pull_request_list', + route_name='pullrequest_show_all', request_method='GET', + renderer='rhodecode:templates/pullrequests/pullrequests.mako') config.add_route( name='pullrequest_show_all_data', pattern='/{repo_name:.*?[^/]}/pull-request-data', repo_route=True, repo_accepted_types=['hg', 'git']) + config.add_view( + RepoPullRequestsView, + attr='pull_request_list_data', + route_name='pullrequest_show_all_data', request_method='GET', + renderer='json_ext', xhr=True) config.add_route( name='pullrequest_repo_refs', pattern='/{repo_name:.*?[^/]}/pull-request/refs/{target_repo_name:.*?[^/]}', repo_route=True) + config.add_view( + RepoPullRequestsView, + attr='pull_request_repo_refs', + route_name='pullrequest_repo_refs', request_method='GET', + renderer='json_ext', xhr=True) config.add_route( name='pullrequest_repo_targets', pattern='/{repo_name:.*?[^/]}/pull-request/repo-targets', repo_route=True) + config.add_view( + RepoPullRequestsView, + attr='pullrequest_repo_targets', + route_name='pullrequest_repo_targets', request_method='GET', + renderer='json_ext', xhr=True) config.add_route( name='pullrequest_new', pattern='/{repo_name:.*?[^/]}/pull-request/new', repo_route=True, repo_accepted_types=['hg', 'git'], repo_forbid_when_archived=True) + config.add_view( + RepoPullRequestsView, + attr='pull_request_new', + route_name='pullrequest_new', request_method='GET', + renderer='rhodecode:templates/pullrequests/pullrequest.mako') config.add_route( name='pullrequest_create', pattern='/{repo_name:.*?[^/]}/pull-request/create', repo_route=True, repo_accepted_types=['hg', 'git'], repo_forbid_when_archived=True) + config.add_view( + RepoPullRequestsView, + attr='pull_request_create', + route_name='pullrequest_create', request_method='POST', + renderer=None) config.add_route( name='pullrequest_update', pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id:\d+}/update', repo_route=True, repo_forbid_when_archived=True) + config.add_view( + RepoPullRequestsView, + attr='pull_request_update', + route_name='pullrequest_update', request_method='POST', + renderer='json_ext') config.add_route( name='pullrequest_merge', pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id:\d+}/merge', repo_route=True, repo_forbid_when_archived=True) + config.add_view( + RepoPullRequestsView, + attr='pull_request_merge', + route_name='pullrequest_merge', request_method='POST', + renderer='json_ext') config.add_route( name='pullrequest_delete', pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id:\d+}/delete', repo_route=True, repo_forbid_when_archived=True) + config.add_view( + RepoPullRequestsView, + attr='pull_request_delete', + route_name='pullrequest_delete', request_method='POST', + renderer='json_ext') config.add_route( name='pullrequest_comment_create', pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id:\d+}/comment', repo_route=True) + config.add_view( + RepoPullRequestsView, + attr='pull_request_comment_create', + route_name='pullrequest_comment_create', request_method='POST', + renderer='json_ext') config.add_route( name='pullrequest_comment_edit', pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id:\d+}/comment/{comment_id}/edit', repo_route=True, repo_accepted_types=['hg', 'git']) + config.add_view( + RepoPullRequestsView, + attr='pull_request_comment_edit', + route_name='pullrequest_comment_edit', request_method='POST', + renderer='json_ext') config.add_route( name='pullrequest_comment_delete', pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id:\d+}/comment/{comment_id}/delete', repo_route=True, repo_accepted_types=['hg', 'git']) + config.add_view( + RepoPullRequestsView, + attr='pull_request_comment_delete', + route_name='pullrequest_comment_delete', request_method='POST', + renderer='json_ext') config.add_route( name='pullrequest_comments', pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id:\d+}/comments', repo_route=True) + config.add_view( + RepoPullRequestsView, + attr='pullrequest_comments', + route_name='pullrequest_comments', request_method='POST', + renderer='string_html', xhr=True) config.add_route( name='pullrequest_todos', pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id:\d+}/todos', repo_route=True) + config.add_view( + RepoPullRequestsView, + attr='pullrequest_todos', + route_name='pullrequest_todos', request_method='POST', + renderer='string_html', xhr=True) config.add_route( name='pullrequest_drafts', pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id:\d+}/drafts', repo_route=True) + config.add_view( + RepoPullRequestsView, + attr='pullrequest_drafts', + route_name='pullrequest_drafts', request_method='POST', + renderer='string_html', xhr=True) # Artifacts, (EE feature) config.add_route( name='repo_artifacts_list', pattern='/{repo_name:.*?[^/]}/artifacts', repo_route=True) + config.add_view( + RepoArtifactsView, + attr='repo_artifacts', + route_name='repo_artifacts_list', request_method='GET', + renderer='rhodecode:templates/artifacts/artifact_list.mako') # Settings config.add_route( name='edit_repo', pattern='/{repo_name:.*?[^/]}/settings', repo_route=True) + config.add_view( + RepoSettingsView, + attr='edit_settings', + route_name='edit_repo', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') # update is POST on edit_repo + config.add_view( + RepoSettingsView, + attr='edit_settings_update', + route_name='edit_repo', request_method='POST', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') # Settings advanced config.add_route( name='edit_repo_advanced', pattern='/{repo_name:.*?[^/]}/settings/advanced', repo_route=True) + config.add_view( + RepoSettingsAdvancedView, + attr='edit_advanced', + route_name='edit_repo_advanced', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') + config.add_route( name='edit_repo_advanced_archive', pattern='/{repo_name:.*?[^/]}/settings/advanced/archive', repo_route=True) + config.add_view( + RepoSettingsAdvancedView, + attr='edit_advanced_archive', + route_name='edit_repo_advanced_archive', request_method='POST', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') + config.add_route( name='edit_repo_advanced_delete', pattern='/{repo_name:.*?[^/]}/settings/advanced/delete', repo_route=True) + config.add_view( + RepoSettingsAdvancedView, + attr='edit_advanced_delete', + route_name='edit_repo_advanced_delete', request_method='POST', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') + config.add_route( name='edit_repo_advanced_locking', pattern='/{repo_name:.*?[^/]}/settings/advanced/locking', repo_route=True) + config.add_view( + RepoSettingsAdvancedView, + attr='edit_advanced_toggle_locking', + route_name='edit_repo_advanced_locking', request_method='POST', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') + config.add_route( name='edit_repo_advanced_journal', pattern='/{repo_name:.*?[^/]}/settings/advanced/journal', repo_route=True) + config.add_view( + RepoSettingsAdvancedView, + attr='edit_advanced_journal', + route_name='edit_repo_advanced_journal', request_method='POST', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') + config.add_route( name='edit_repo_advanced_fork', pattern='/{repo_name:.*?[^/]}/settings/advanced/fork', repo_route=True) + config.add_view( + RepoSettingsAdvancedView, + attr='edit_advanced_fork', + route_name='edit_repo_advanced_fork', request_method='POST', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') config.add_route( name='edit_repo_advanced_hooks', pattern='/{repo_name:.*?[^/]}/settings/advanced/hooks', repo_route=True) + config.add_view( + RepoSettingsAdvancedView, + attr='edit_advanced_install_hooks', + route_name='edit_repo_advanced_hooks', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') # Caches config.add_route( name='edit_repo_caches', pattern='/{repo_name:.*?[^/]}/settings/caches', repo_route=True) + config.add_view( + RepoCachesView, + attr='repo_caches', + route_name='edit_repo_caches', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') + config.add_view( + RepoCachesView, + attr='repo_caches_purge', + route_name='edit_repo_caches', request_method='POST') # Permissions config.add_route( name='edit_repo_perms', pattern='/{repo_name:.*?[^/]}/settings/permissions', repo_route=True) + config.add_view( + RepoSettingsPermissionsView, + attr='edit_permissions', + route_name='edit_repo_perms', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') + config.add_view( + RepoSettingsPermissionsView, + attr='edit_permissions_update', + route_name='edit_repo_perms', request_method='POST', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') config.add_route( name='edit_repo_perms_set_private', pattern='/{repo_name:.*?[^/]}/settings/permissions/set_private', repo_route=True) + config.add_view( + RepoSettingsPermissionsView, + attr='edit_permissions_set_private_repo', + route_name='edit_repo_perms_set_private', request_method='POST', + renderer='json_ext') # Permissions Branch (EE feature) config.add_route( name='edit_repo_perms_branch', pattern='/{repo_name:.*?[^/]}/settings/branch_permissions', repo_route=True) + config.add_view( + RepoBranchesView, + attr='branches', + route_name='edit_repo_perms_branch', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') + config.add_route( name='edit_repo_perms_branch_delete', pattern='/{repo_name:.*?[^/]}/settings/branch_permissions/{rule_id}/delete', repo_route=True) + ## Only implemented in EE # Maintenance config.add_route( name='edit_repo_maintenance', pattern='/{repo_name:.*?[^/]}/settings/maintenance', repo_route=True) + config.add_view( + RepoMaintenanceView, + attr='repo_maintenance', + route_name='edit_repo_maintenance_execute', request_method='GET', + renderer='json', xhr=True) config.add_route( name='edit_repo_maintenance_execute', pattern='/{repo_name:.*?[^/]}/settings/maintenance/execute', repo_route=True) + config.add_view( + RepoMaintenanceView, + attr='repo_maintenance_execute', + route_name='edit_repo_maintenance', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') # Fields config.add_route( name='edit_repo_fields', pattern='/{repo_name:.*?[^/]}/settings/fields', repo_route=True) + config.add_view( + RepoSettingsFieldsView, + attr='repo_field_edit', + route_name='edit_repo_fields', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') + config.add_route( name='edit_repo_fields_create', pattern='/{repo_name:.*?[^/]}/settings/fields/create', repo_route=True) + config.add_view( + RepoSettingsFieldsView, + attr='repo_field_create', + route_name='edit_repo_fields_create', request_method='POST', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') + config.add_route( name='edit_repo_fields_delete', pattern='/{repo_name:.*?[^/]}/settings/fields/{field_id}/delete', repo_route=True) + config.add_view( + RepoSettingsFieldsView, + attr='repo_field_delete', + route_name='edit_repo_fields_delete', request_method='POST', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') # Locking config.add_route( name='repo_edit_toggle_locking', pattern='/{repo_name:.*?[^/]}/settings/toggle_locking', repo_route=True) + config.add_view( + RepoSettingsView, + attr='edit_advanced_toggle_locking', + route_name='repo_edit_toggle_locking', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') # Remote config.add_route( name='edit_repo_remote', pattern='/{repo_name:.*?[^/]}/settings/remote', repo_route=True) + config.add_view( + RepoSettingsRemoteView, + attr='repo_remote_edit_form', + route_name='edit_repo_remote', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') + config.add_route( name='edit_repo_remote_pull', pattern='/{repo_name:.*?[^/]}/settings/remote/pull', repo_route=True) + config.add_view( + RepoSettingsRemoteView, + attr='repo_remote_pull_changes', + route_name='edit_repo_remote_pull', request_method='POST', + renderer=None) + config.add_route( name='edit_repo_remote_push', pattern='/{repo_name:.*?[^/]}/settings/remote/push', repo_route=True) @@ -458,91 +1027,201 @@ def includeme(config): config.add_route( name='edit_repo_statistics', pattern='/{repo_name:.*?[^/]}/settings/statistics', repo_route=True) + config.add_view( + RepoSettingsView, + attr='edit_statistics_form', + route_name='edit_repo_statistics', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') + config.add_route( name='edit_repo_statistics_reset', pattern='/{repo_name:.*?[^/]}/settings/statistics/update', repo_route=True) + config.add_view( + RepoSettingsView, + attr='repo_statistics_reset', + route_name='edit_repo_statistics_reset', request_method='POST', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') # Issue trackers config.add_route( name='edit_repo_issuetracker', pattern='/{repo_name:.*?[^/]}/settings/issue_trackers', repo_route=True) + config.add_view( + RepoSettingsIssueTrackersView, + attr='repo_issuetracker', + route_name='edit_repo_issuetracker', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') + config.add_route( name='edit_repo_issuetracker_test', pattern='/{repo_name:.*?[^/]}/settings/issue_trackers/test', repo_route=True) + config.add_view( + RepoSettingsIssueTrackersView, + attr='repo_issuetracker_test', + route_name='edit_repo_issuetracker_test', request_method='POST', + renderer='string', xhr=True) + config.add_route( name='edit_repo_issuetracker_delete', pattern='/{repo_name:.*?[^/]}/settings/issue_trackers/delete', repo_route=True) + config.add_view( + RepoSettingsIssueTrackersView, + attr='repo_issuetracker_delete', + route_name='edit_repo_issuetracker_delete', request_method='POST', + renderer='json_ext', xhr=True) + config.add_route( name='edit_repo_issuetracker_update', pattern='/{repo_name:.*?[^/]}/settings/issue_trackers/update', repo_route=True) + config.add_view( + RepoSettingsIssueTrackersView, + attr='repo_issuetracker_update', + route_name='edit_repo_issuetracker_update', request_method='POST', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') # VCS Settings config.add_route( name='edit_repo_vcs', pattern='/{repo_name:.*?[^/]}/settings/vcs', repo_route=True) + config.add_view( + RepoSettingsVcsView, + attr='repo_vcs_settings', + route_name='edit_repo_vcs', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') + config.add_route( name='edit_repo_vcs_update', pattern='/{repo_name:.*?[^/]}/settings/vcs/update', repo_route=True) + config.add_view( + RepoSettingsVcsView, + attr='repo_settings_vcs_update', + route_name='edit_repo_vcs_update', request_method='POST', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') # svn pattern config.add_route( name='edit_repo_vcs_svn_pattern_delete', pattern='/{repo_name:.*?[^/]}/settings/vcs/svn_pattern/delete', repo_route=True) + config.add_view( + RepoSettingsVcsView, + attr='repo_settings_delete_svn_pattern', + route_name='edit_repo_vcs_svn_pattern_delete', request_method='POST', + renderer='json_ext', xhr=True) # Repo Review Rules (EE feature) config.add_route( name='repo_reviewers', pattern='/{repo_name:.*?[^/]}/settings/review/rules', repo_route=True) + config.add_view( + RepoReviewRulesView, + attr='repo_review_rules', + route_name='repo_reviewers', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') config.add_route( name='repo_default_reviewers_data', pattern='/{repo_name:.*?[^/]}/settings/review/default-reviewers', repo_route=True) + config.add_view( + RepoReviewRulesView, + attr='repo_default_reviewers_data', + route_name='repo_default_reviewers_data', request_method='GET', + renderer='json_ext') # Repo Automation (EE feature) config.add_route( name='repo_automation', pattern='/{repo_name:.*?[^/]}/settings/automation', repo_route=True) + config.add_view( + RepoAutomationView, + attr='repo_automation', + route_name='repo_automation', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') # Strip config.add_route( name='edit_repo_strip', pattern='/{repo_name:.*?[^/]}/settings/strip', repo_route=True) + config.add_view( + RepoStripView, + attr='strip', + route_name='edit_repo_strip', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') config.add_route( name='strip_check', pattern='/{repo_name:.*?[^/]}/settings/strip_check', repo_route=True) + config.add_view( + RepoStripView, + attr='strip_check', + route_name='strip_check', request_method='POST', + renderer='json', xhr=True) config.add_route( name='strip_execute', pattern='/{repo_name:.*?[^/]}/settings/strip_execute', repo_route=True) + config.add_view( + RepoStripView, + attr='strip_execute', + route_name='strip_execute', request_method='POST', + renderer='json', xhr=True) # Audit logs config.add_route( name='edit_repo_audit_logs', pattern='/{repo_name:.*?[^/]}/settings/audit_logs', repo_route=True) + config.add_view( + AuditLogsView, + attr='repo_audit_logs', + route_name='edit_repo_audit_logs', request_method='GET', + renderer='rhodecode:templates/admin/repos/repo_edit.mako') # ATOM/RSS Feed, shouldn't contain slashes for outlook compatibility config.add_route( name='rss_feed_home', pattern='/{repo_name:.*?[^/]}/feed-rss', repo_route=True) + config.add_view( + RepoFeedView, + attr='rss', + route_name='rss_feed_home', request_method='GET', renderer=None) + + config.add_route( + name='rss_feed_home_old', + pattern='/{repo_name:.*?[^/]}/feed/rss', repo_route=True) + config.add_view( + RepoFeedView, + attr='rss', + route_name='rss_feed_home_old', request_method='GET', renderer=None) config.add_route( name='atom_feed_home', pattern='/{repo_name:.*?[^/]}/feed-atom', repo_route=True) - - config.add_route( - name='rss_feed_home_old', - pattern='/{repo_name:.*?[^/]}/feed/rss', repo_route=True) + config.add_view( + RepoFeedView, + attr='atom', + route_name='atom_feed_home', request_method='GET', renderer=None) config.add_route( name='atom_feed_home_old', pattern='/{repo_name:.*?[^/]}/feed/atom', repo_route=True) + config.add_view( + RepoFeedView, + attr='atom', + route_name='atom_feed_home_old', request_method='GET', renderer=None) # NOTE(marcink): needs to be at the end for catch-all add_route_with_slash( config, name='repo_summary', pattern='/{repo_name:.*?[^/]}', repo_route=True) - - # Scan module for configuration decorators. - config.scan('.views', ignore='.tests') + config.add_view( + RepoSummaryView, + attr='summary', + route_name='repo_summary', request_method='GET', + renderer='rhodecode:templates/summary/summary.mako') + + # TODO(marcink): there's no such route?? + config.add_view( + RepoSummaryView, + attr='summary', + route_name='repo_summary_slash', request_method='GET', + renderer='rhodecode:templates/summary/summary.mako') \ No newline at end of file diff --git a/rhodecode/apps/repository/views/repo_artifacts.py b/rhodecode/apps/repository/views/repo_artifacts.py --- a/rhodecode/apps/repository/views/repo_artifacts.py +++ b/rhodecode/apps/repository/views/repo_artifacts.py @@ -20,7 +20,7 @@ import logging -from pyramid.view import view_config + from rhodecode.apps._base import RepoAppView from rhodecode.lib.auth import ( @@ -39,9 +39,6 @@ class RepoArtifactsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_artifacts_list', request_method='GET', - renderer='rhodecode:templates/artifacts/artifact_list.mako') def repo_artifacts(self): c = self.load_default_context() c.active = 'artifacts' diff --git a/rhodecode/apps/repository/views/repo_audit_logs.py b/rhodecode/apps/repository/views/repo_audit_logs.py --- a/rhodecode/apps/repository/views/repo_audit_logs.py +++ b/rhodecode/apps/repository/views/repo_audit_logs.py @@ -19,7 +19,7 @@ # and proprietary license terms, please see https://rhodecode.com/licenses/ import logging -from pyramid.view import view_config + from rhodecode.apps._base import RepoAppView from rhodecode.lib.helpers import SqlPage @@ -38,9 +38,6 @@ class AuditLogsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') - @view_config( - route_name='edit_repo_audit_logs', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def repo_audit_logs(self): _ = self.request.translate c = self.load_default_context() diff --git a/rhodecode/apps/repository/views/repo_automation.py b/rhodecode/apps/repository/views/repo_automation.py --- a/rhodecode/apps/repository/views/repo_automation.py +++ b/rhodecode/apps/repository/views/repo_automation.py @@ -20,7 +20,7 @@ import logging -from pyramid.view import view_config + from rhodecode.apps._base import RepoAppView from rhodecode.apps.repository.utils import get_default_reviewers_data @@ -36,9 +36,6 @@ class RepoAutomationView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') - @view_config( - route_name='repo_automation', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def repo_automation(self): c = self.load_default_context() c.active = 'automation' diff --git a/rhodecode/apps/repository/views/repo_bookmarks.py b/rhodecode/apps/repository/views/repo_bookmarks.py --- a/rhodecode/apps/repository/views/repo_bookmarks.py +++ b/rhodecode/apps/repository/views/repo_bookmarks.py @@ -20,7 +20,7 @@ import logging from pyramid.httpexceptions import HTTPNotFound -from pyramid.view import view_config + from rhodecode.apps._base import BaseReferencesView from rhodecode.lib.ext_json import json @@ -36,9 +36,6 @@ class RepoBookmarksView(BaseReferencesVi @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='bookmarks_home', request_method='GET', - renderer='rhodecode:templates/bookmarks/bookmarks.mako') def bookmarks(self): c = self.load_default_context() diff --git a/rhodecode/apps/repository/views/repo_branch_permissions.py b/rhodecode/apps/repository/views/repo_branch_permissions.py --- a/rhodecode/apps/repository/views/repo_branch_permissions.py +++ b/rhodecode/apps/repository/views/repo_branch_permissions.py @@ -20,7 +20,7 @@ import logging -from pyramid.view import view_config + from rhodecode.apps._base import RepoAppView from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator @@ -36,9 +36,6 @@ class RepoSettingsBranchPermissionsView( @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') - @view_config( - route_name='edit_repo_perms_branch', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def branch_permissions(self): c = self.load_default_context() c.active = 'permissions_branch' diff --git a/rhodecode/apps/repository/views/repo_branches.py b/rhodecode/apps/repository/views/repo_branches.py --- a/rhodecode/apps/repository/views/repo_branches.py +++ b/rhodecode/apps/repository/views/repo_branches.py @@ -19,7 +19,7 @@ # and proprietary license terms, please see https://rhodecode.com/licenses/ import logging -from pyramid.view import view_config + from rhodecode.apps._base import BaseReferencesView from rhodecode.lib.ext_json import json @@ -34,9 +34,6 @@ class RepoBranchesView(BaseReferencesVie @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='branches_home', request_method='GET', - renderer='rhodecode:templates/branches/branches.mako') def branches(self): c = self.load_default_context() diff --git a/rhodecode/apps/repository/views/repo_caches.py b/rhodecode/apps/repository/views/repo_caches.py --- a/rhodecode/apps/repository/views/repo_caches.py +++ b/rhodecode/apps/repository/views/repo_caches.py @@ -22,7 +22,7 @@ import os import logging from pyramid.httpexceptions import HTTPFound -from pyramid.view import view_config + from rhodecode.apps._base import RepoAppView from rhodecode.lib.auth import ( @@ -42,9 +42,6 @@ class RepoCachesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') - @view_config( - route_name='edit_repo_caches', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def repo_caches(self): c = self.load_default_context() c.active = 'caches' @@ -65,8 +62,6 @@ class RepoCachesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_caches', request_method='POST') def repo_caches_purge(self): _ = self.request.translate c = self.load_default_context() diff --git a/rhodecode/apps/repository/views/repo_changelog.py b/rhodecode/apps/repository/views/repo_changelog.py --- a/rhodecode/apps/repository/views/repo_changelog.py +++ b/rhodecode/apps/repository/views/repo_changelog.py @@ -22,7 +22,7 @@ import logging from pyramid.httpexceptions import HTTPNotFound, HTTPFound -from pyramid.view import view_config + from pyramid.renderers import render from pyramid.response import Response @@ -176,19 +176,6 @@ class RepoChangelogView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_commits', request_method='GET', - renderer='rhodecode:templates/commits/changelog.mako') - @view_config( - route_name='repo_commits_file', request_method='GET', - renderer='rhodecode:templates/commits/changelog.mako') - # old routes for backward compat - @view_config( - route_name='repo_changelog', request_method='GET', - renderer='rhodecode:templates/commits/changelog.mako') - @view_config( - route_name='repo_changelog_file', request_method='GET', - renderer='rhodecode:templates/commits/changelog.mako') def repo_changelog(self): c = self.load_default_context() @@ -291,14 +278,6 @@ class RepoChangelogView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_commits_elements', request_method=('GET', 'POST'), - renderer='rhodecode:templates/commits/changelog_elements.mako', - xhr=True) - @view_config( - route_name='repo_commits_elements_file', request_method=('GET', 'POST'), - renderer='rhodecode:templates/commits/changelog_elements.mako', - xhr=True) def repo_commits_elements(self): c = self.load_default_context() commit_id = self.request.matchdict.get('commit_id') diff --git a/rhodecode/apps/repository/views/repo_checks.py b/rhodecode/apps/repository/views/repo_checks.py --- a/rhodecode/apps/repository/views/repo_checks.py +++ b/rhodecode/apps/repository/views/repo_checks.py @@ -20,10 +20,8 @@ import logging -from pyramid.view import view_config from pyramid.httpexceptions import HTTPFound, HTTPNotFound -from rhodecode import events from rhodecode.apps._base import BaseAppView from rhodecode.lib import helpers as h from rhodecode.lib.auth import (NotAnonymous, HasRepoPermissionAny) @@ -37,13 +35,9 @@ log = logging.getLogger(__name__) class RepoChecksView(BaseAppView): def load_default_context(self): c = self._get_local_tmpl_context() - return c @NotAnonymous() - @view_config( - route_name='repo_creating', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_creating.mako') def repo_creating(self): c = self.load_default_context() repo_name = self.request.matchdict['repo_name'] @@ -71,9 +65,6 @@ class RepoChecksView(BaseAppView): return self._get_template_context(c) @NotAnonymous() - @view_config( - route_name='repo_creating_check', request_method='GET', - renderer='json_ext') def repo_creating_check(self): _ = self.request.translate task_id = self.request.GET.get('task_id') diff --git a/rhodecode/apps/repository/views/repo_commits.py b/rhodecode/apps/repository/views/repo_commits.py --- a/rhodecode/apps/repository/views/repo_commits.py +++ b/rhodecode/apps/repository/views/repo_commits.py @@ -23,7 +23,6 @@ import collections from pyramid.httpexceptions import ( HTTPNotFound, HTTPBadRequest, HTTPFound, HTTPForbidden, HTTPConflict) -from pyramid.view import view_config from pyramid.renderers import render from pyramid.response import Response @@ -340,9 +339,6 @@ class RepoCommitsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_commit', request_method='GET', - renderer=None) def repo_commit_show(self): commit_id = self.request.matchdict['commit_id'] return self._commit(commit_id, method='show') @@ -350,12 +346,6 @@ class RepoCommitsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_commit_raw', request_method='GET', - renderer=None) - @view_config( - route_name='repo_commit_raw_deprecated', request_method='GET', - renderer=None) def repo_commit_raw(self): commit_id = self.request.matchdict['commit_id'] return self._commit(commit_id, method='raw') @@ -363,9 +353,6 @@ class RepoCommitsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_commit_patch', request_method='GET', - renderer=None) def repo_commit_patch(self): commit_id = self.request.matchdict['commit_id'] return self._commit(commit_id, method='patch') @@ -373,9 +360,6 @@ class RepoCommitsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_commit_download', request_method='GET', - renderer=None) def repo_commit_download(self): commit_id = self.request.matchdict['commit_id'] return self._commit(commit_id, method='download') @@ -500,9 +484,6 @@ class RepoCommitsView(RepoAppView): @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='repo_commit_comment_create', request_method='POST', - renderer='json_ext') def repo_commit_comment_create(self): _ = self.request.translate commit_id = self.request.matchdict['commit_id'] @@ -538,9 +519,6 @@ class RepoCommitsView(RepoAppView): @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='repo_commit_comment_preview', request_method='POST', - renderer='string', xhr=True) def repo_commit_comment_preview(self): # Technically a CSRF token is not needed as no state changes with this # call. However, as this is a POST is better to have it, so automated @@ -559,9 +537,6 @@ class RepoCommitsView(RepoAppView): @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='repo_commit_comment_history_view', request_method='POST', - renderer='string', xhr=True) def repo_commit_comment_history_view(self): c = self.load_default_context() @@ -587,9 +562,6 @@ class RepoCommitsView(RepoAppView): @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='repo_commit_comment_attachment_upload', request_method='POST', - renderer='json_ext', xhr=True) def repo_commit_comment_attachment_upload(self): c = self.load_default_context() upload_key = 'attachment' @@ -682,9 +654,6 @@ class RepoCommitsView(RepoAppView): @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='repo_commit_comment_delete', request_method='POST', - renderer='json_ext') def repo_commit_comment_delete(self): commit_id = self.request.matchdict['commit_id'] comment_id = self.request.matchdict['comment_id'] @@ -719,9 +688,6 @@ class RepoCommitsView(RepoAppView): @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='repo_commit_comment_edit', request_method='POST', - renderer='json_ext') def repo_commit_comment_edit(self): self.load_default_context() @@ -802,9 +768,6 @@ class RepoCommitsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_commit_data', request_method='GET', - renderer='json_ext', xhr=True) def repo_commit_data(self): commit_id = self.request.matchdict['commit_id'] self.load_default_context() @@ -817,9 +780,6 @@ class RepoCommitsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_commit_children', request_method='GET', - renderer='json_ext', xhr=True) def repo_commit_children(self): commit_id = self.request.matchdict['commit_id'] self.load_default_context() @@ -836,9 +796,6 @@ class RepoCommitsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_commit_parents', request_method='GET', - renderer='json_ext') def repo_commit_parents(self): commit_id = self.request.matchdict['commit_id'] self.load_default_context() diff --git a/rhodecode/apps/repository/views/repo_compare.py b/rhodecode/apps/repository/views/repo_compare.py --- a/rhodecode/apps/repository/views/repo_compare.py +++ b/rhodecode/apps/repository/views/repo_compare.py @@ -22,7 +22,7 @@ import logging from pyramid.httpexceptions import HTTPBadRequest, HTTPNotFound, HTTPFound -from pyramid.view import view_config + from pyramid.renderers import render from pyramid.response import Response @@ -79,9 +79,6 @@ class RepoCompareView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_compare_select', request_method='GET', - renderer='rhodecode:templates/compare/compare_diff.mako') def compare_select(self): _ = self.request.translate c = self.load_default_context() @@ -111,9 +108,6 @@ class RepoCompareView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_compare', request_method='GET', - renderer=None) def compare(self): _ = self.request.translate c = self.load_default_context() diff --git a/rhodecode/apps/repository/views/repo_feed.py b/rhodecode/apps/repository/views/repo_feed.py --- a/rhodecode/apps/repository/views/repo_feed.py +++ b/rhodecode/apps/repository/views/repo_feed.py @@ -20,10 +20,8 @@ import pytz import logging -from pyramid.view import view_config from pyramid.response import Response - from rhodecode.apps._base import RepoAppView from rhodecode.lib.feedgenerator import Rss201rev2Feed, Atom1Feed from rhodecode.lib import audit_logger @@ -118,8 +116,6 @@ class RepoFeedView(RepoAppView): @LoginRequired(auth_token_access=[UserApiKeys.ROLE_FEED]) @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config(route_name='atom_feed_home', request_method='GET', renderer=None) - @view_config(route_name='atom_feed_home_old', request_method='GET', renderer=None) def atom(self): """ Produce an atom-1.0 feed via feedgenerator module @@ -166,8 +162,6 @@ class RepoFeedView(RepoAppView): @LoginRequired(auth_token_access=[UserApiKeys.ROLE_FEED]) @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config(route_name='rss_feed_home', request_method='GET', renderer=None) - @view_config(route_name='rss_feed_home_old', request_method='GET', renderer=None) def rss(self): """ Produce an rss2 feed via feedgenerator module diff --git a/rhodecode/apps/repository/views/repo_files.py b/rhodecode/apps/repository/views/repo_files.py --- a/rhodecode/apps/repository/views/repo_files.py +++ b/rhodecode/apps/repository/views/repo_files.py @@ -28,7 +28,7 @@ import urllib import pathlib2 from pyramid.httpexceptions import HTTPNotFound, HTTPBadRequest, HTTPFound -from pyramid.view import view_config + from pyramid.renderers import render from pyramid.response import Response @@ -343,9 +343,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_archivefile', request_method='GET', - renderer=None) def repo_archivefile(self): # archive cache config from rhodecode import CONFIG @@ -496,9 +493,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_files_diff', request_method='GET', - renderer=None) def repo_files_diff(self): c = self.load_default_context() f_path = self._get_f_path(self.request.matchdict) @@ -581,9 +575,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_files_diff_2way_redirect', request_method='GET', - renderer=None) def repo_files_diff_2way_redirect(self): """ Kept only to make OLD links work @@ -610,10 +601,11 @@ class RepoFilesView(RepoAppView): raise HTTPFound(compare_url) @LoginRequired() - @view_config( - route_name='repo_files:default_commit', request_method='GET', - renderer=None) - def repo_files_default(self): + def repo_files_default_commit_redirect(self): + """ + Special page that redirects to the landing page of files based on the default + commit for repository + """ c = self.load_default_context() ref_name = c.rhodecode_db_repo.landing_ref_name landing_url = h.repo_files_by_ref_url( @@ -630,18 +622,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_files', request_method='GET', - renderer=None) - @view_config( - route_name='repo_files:default_path', request_method='GET', - renderer=None) - @view_config( - route_name='repo_files:rendered', request_method='GET', - renderer=None) - @view_config( - route_name='repo_files:annotated', request_method='GET', - renderer=None) def repo_files(self): c = self.load_default_context() @@ -759,9 +739,6 @@ class RepoFilesView(RepoAppView): @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_files:annotated_previous', request_method='GET', - renderer=None) def repo_files_annotated_previous(self): self.load_default_context() @@ -790,12 +767,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_nodetree_full', request_method='GET', - renderer=None, xhr=True) - @view_config( - route_name='repo_nodetree_full:default_path', request_method='GET', - renderer=None, xhr=True) def repo_nodetree_full(self): """ Returns rendered html of file tree that contains commit date, @@ -835,9 +806,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_file_raw', request_method='GET', - renderer=None) def repo_file_raw(self): """ Action for show as raw, some mimetypes are "rendered", @@ -902,12 +870,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_file_download', request_method='GET', - renderer=None) - @view_config( - route_name='repo_file_download:legacy', request_method='GET', - renderer=None) def repo_file_download(self): c = self.load_default_context() @@ -972,9 +934,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_files_nodelist', request_method='GET', - renderer='json_ext', xhr=True) def repo_nodelist(self): self.load_default_context() @@ -1059,9 +1018,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_file_history', request_method='GET', - renderer='json_ext') def repo_file_history(self): self.load_default_context() @@ -1105,9 +1061,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_file_authors', request_method='GET', - renderer='rhodecode:templates/files/file_authors_box.mako') def repo_file_authors(self): c = self.load_default_context() @@ -1149,9 +1102,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin') - @view_config( - route_name='repo_files_check_head', request_method='POST', - renderer='json_ext', xhr=True) def repo_files_check_head(self): self.load_default_context() @@ -1186,9 +1136,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin') - @view_config( - route_name='repo_files_remove_file', request_method='GET', - renderer='rhodecode:templates/files/files_delete.mako') def repo_files_remove_file(self): _ = self.request.translate c = self.load_default_context() @@ -1214,9 +1161,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='repo_files_delete_file', request_method='POST', - renderer=None) def repo_files_delete_file(self): _ = self.request.translate @@ -1266,9 +1210,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin') - @view_config( - route_name='repo_files_edit_file', request_method='GET', - renderer='rhodecode:templates/files/files_edit.mako') def repo_files_edit_file(self): _ = self.request.translate c = self.load_default_context() @@ -1300,9 +1241,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='repo_files_update_file', request_method='POST', - renderer=None) def repo_files_update_file(self): _ = self.request.translate c = self.load_default_context() @@ -1384,12 +1322,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin') - @view_config( - route_name='repo_files_add_file', request_method='GET', - renderer='rhodecode:templates/files/files_add.mako') - @view_config( - route_name='repo_files_upload_file', request_method='GET', - renderer='rhodecode:templates/files/files_upload.mako') def repo_files_add_file(self): _ = self.request.translate c = self.load_default_context() @@ -1421,9 +1353,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='repo_files_create_file', request_method='POST', - renderer=None) def repo_files_create_file(self): _ = self.request.translate c = self.load_default_context() @@ -1518,9 +1447,6 @@ class RepoFilesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='repo_files_upload_file', request_method='POST', - renderer='json_ext') def repo_files_upload_file(self): _ = self.request.translate c = self.load_default_context() diff --git a/rhodecode/apps/repository/views/repo_forks.py b/rhodecode/apps/repository/views/repo_forks.py --- a/rhodecode/apps/repository/views/repo_forks.py +++ b/rhodecode/apps/repository/views/repo_forks.py @@ -24,7 +24,7 @@ import formencode import formencode.htmlfill from pyramid.httpexceptions import HTTPFound -from pyramid.view import view_config + from pyramid.renderers import render from pyramid.response import Response @@ -64,9 +64,6 @@ class RepoForksView(RepoAppView, DataGri @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_forks_show_all', request_method='GET', - renderer='rhodecode:templates/forks/forks.mako') def repo_forks_show_all(self): c = self.load_default_context() return self._get_template_context(c) @@ -74,9 +71,6 @@ class RepoForksView(RepoAppView, DataGri @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_forks_data', request_method='GET', - renderer='json_ext', xhr=True) def repo_forks_data(self): _ = self.request.translate self.load_default_context() @@ -174,9 +168,6 @@ class RepoForksView(RepoAppView, DataGri @HasPermissionAnyDecorator('hg.admin', 'hg.fork.repository') @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_fork_new', request_method='GET', - renderer='rhodecode:templates/forks/forks.mako') def repo_fork_new(self): c = self.load_default_context() @@ -204,9 +195,6 @@ class RepoForksView(RepoAppView, DataGri @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='repo_fork_create', request_method='POST', - renderer='rhodecode:templates/forks/fork.mako') def repo_fork_create(self): _ = self.request.translate c = self.load_default_context() diff --git a/rhodecode/apps/repository/views/repo_maintainance.py b/rhodecode/apps/repository/views/repo_maintainance.py --- a/rhodecode/apps/repository/views/repo_maintainance.py +++ b/rhodecode/apps/repository/views/repo_maintainance.py @@ -20,7 +20,7 @@ import logging -from pyramid.view import view_config + from rhodecode.apps._base import RepoAppView from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator @@ -36,9 +36,6 @@ class RepoMaintenanceView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') - @view_config( - route_name='edit_repo_maintenance', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def repo_maintenance(self): c = self.load_default_context() c.active = 'maintenance' @@ -48,9 +45,6 @@ class RepoMaintenanceView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') - @view_config( - route_name='edit_repo_maintenance_execute', request_method='GET', - renderer='json', xhr=True) def repo_maintenance_execute(self): c = self.load_default_context() c.active = 'maintenance' diff --git a/rhodecode/apps/repository/views/repo_permissions.py b/rhodecode/apps/repository/views/repo_permissions.py --- a/rhodecode/apps/repository/views/repo_permissions.py +++ b/rhodecode/apps/repository/views/repo_permissions.py @@ -21,7 +21,6 @@ import logging from pyramid.httpexceptions import HTTPFound -from pyramid.view import view_config from rhodecode.apps._base import RepoAppView from rhodecode.lib import helpers as h @@ -46,9 +45,6 @@ class RepoSettingsPermissionsView(RepoAp @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') - @view_config( - route_name='edit_repo_perms', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def edit_permissions(self): _ = self.request.translate c = self.load_default_context() @@ -62,9 +58,6 @@ class RepoSettingsPermissionsView(RepoAp @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_perms', request_method='POST', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def edit_permissions_update(self): _ = self.request.translate c = self.load_default_context() @@ -104,9 +97,6 @@ class RepoSettingsPermissionsView(RepoAp @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_perms_set_private', request_method='POST', - renderer='json_ext') def edit_permissions_set_private_repo(self): _ = self.request.translate self.load_default_context() diff --git a/rhodecode/apps/repository/views/repo_pull_requests.py b/rhodecode/apps/repository/views/repo_pull_requests.py --- a/rhodecode/apps/repository/views/repo_pull_requests.py +++ b/rhodecode/apps/repository/views/repo_pull_requests.py @@ -26,7 +26,7 @@ import formencode.htmlfill import peppercorn from pyramid.httpexceptions import ( HTTPFound, HTTPNotFound, HTTPForbidden, HTTPBadRequest, HTTPConflict) -from pyramid.view import view_config + from pyramid.renderers import render from rhodecode.apps._base import RepoAppView, DataGridAppView @@ -147,9 +147,6 @@ class RepoPullRequestsView(RepoAppView, @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='pullrequest_show_all', request_method='GET', - renderer='rhodecode:templates/pullrequests/pullrequests.mako') def pull_request_list(self): c = self.load_default_context() @@ -177,9 +174,6 @@ class RepoPullRequestsView(RepoAppView, @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='pullrequest_show_all_data', request_method='GET', - renderer='json_ext', xhr=True) def pull_request_list_data(self): self.load_default_context() @@ -311,9 +305,6 @@ class RepoPullRequestsView(RepoAppView, @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='pullrequest_show', request_method='GET', - renderer='rhodecode:templates/pullrequests/pullrequest_show.mako') def pull_request_show(self): _ = self.request.translate c = self.load_default_context() @@ -842,9 +833,6 @@ class RepoPullRequestsView(RepoAppView, @NotAnonymous() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='pullrequest_new', request_method='GET', - renderer='rhodecode:templates/pullrequests/pullrequest.mako') def pull_request_new(self): _ = self.request.translate c = self.load_default_context() @@ -902,9 +890,6 @@ class RepoPullRequestsView(RepoAppView, @NotAnonymous() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='pullrequest_repo_refs', request_method='GET', - renderer='json_ext', xhr=True) def pull_request_repo_refs(self): self.load_default_context() target_repo_name = self.request.matchdict['target_repo_name'] @@ -925,9 +910,6 @@ class RepoPullRequestsView(RepoAppView, @NotAnonymous() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='pullrequest_repo_targets', request_method='GET', - renderer='json_ext', xhr=True) def pullrequest_repo_targets(self): _ = self.request.translate filter_query = self.request.GET.get('query') @@ -998,9 +980,6 @@ class RepoPullRequestsView(RepoAppView, @NotAnonymous() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='pullrequest_comments', request_method='POST', - renderer='string_html', xhr=True) def pullrequest_comments(self): self.load_default_context() @@ -1038,9 +1017,6 @@ class RepoPullRequestsView(RepoAppView, @NotAnonymous() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='pullrequest_todos', request_method='POST', - renderer='string_html', xhr=True) def pullrequest_todos(self): self.load_default_context() @@ -1080,9 +1056,6 @@ class RepoPullRequestsView(RepoAppView, @NotAnonymous() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='pullrequest_drafts', request_method='POST', - renderer='string_html', xhr=True) def pullrequest_drafts(self): self.load_default_context() @@ -1123,9 +1096,6 @@ class RepoPullRequestsView(RepoAppView, @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='pullrequest_create', request_method='POST', - renderer=None) def pull_request_create(self): _ = self.request.translate self.assure_not_empty_repo() @@ -1281,9 +1251,6 @@ class RepoPullRequestsView(RepoAppView, @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='pullrequest_update', request_method='POST', - renderer='json_ext') def pull_request_update(self): pull_request = PullRequest.get_or_404( self.request.matchdict['pull_request_id']) @@ -1465,9 +1432,6 @@ class RepoPullRequestsView(RepoAppView, @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='pullrequest_merge', request_method='POST', - renderer='json_ext') def pull_request_merge(self): """ Merge will perform a server-side merge of the specified @@ -1541,9 +1505,6 @@ class RepoPullRequestsView(RepoAppView, @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='pullrequest_delete', request_method='POST', - renderer='json_ext') def pull_request_delete(self): _ = self.request.translate @@ -1719,9 +1680,6 @@ class RepoPullRequestsView(RepoAppView, @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='pullrequest_comment_create', request_method='POST', - renderer='json_ext') def pull_request_comment_create(self): _ = self.request.translate @@ -1756,9 +1714,6 @@ class RepoPullRequestsView(RepoAppView, @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='pullrequest_comment_delete', request_method='POST', - renderer='json_ext') def pull_request_comment_delete(self): pull_request = PullRequest.get_or_404( self.request.matchdict['pull_request_id']) @@ -1810,9 +1765,6 @@ class RepoPullRequestsView(RepoAppView, @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') @CSRFRequired() - @view_config( - route_name='pullrequest_comment_edit', request_method='POST', - renderer='json_ext') def pull_request_comment_edit(self): self.load_default_context() diff --git a/rhodecode/apps/repository/views/repo_review_rules.py b/rhodecode/apps/repository/views/repo_review_rules.py --- a/rhodecode/apps/repository/views/repo_review_rules.py +++ b/rhodecode/apps/repository/views/repo_review_rules.py @@ -20,7 +20,7 @@ import logging -from pyramid.view import view_config + from rhodecode.apps._base import RepoAppView from rhodecode.apps.repository.utils import get_default_reviewers_data @@ -38,9 +38,6 @@ class RepoReviewRulesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') - @view_config( - route_name='repo_reviewers', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def repo_review_rules(self): c = self.load_default_context() c.active = 'reviewers' @@ -50,9 +47,6 @@ class RepoReviewRulesView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_default_reviewers_data', request_method='GET', - renderer='json_ext') def repo_default_reviewers_data(self): self.load_default_context() diff --git a/rhodecode/apps/repository/views/repo_settings.py b/rhodecode/apps/repository/views/repo_settings.py --- a/rhodecode/apps/repository/views/repo_settings.py +++ b/rhodecode/apps/repository/views/repo_settings.py @@ -22,7 +22,6 @@ import logging import deform from pyramid.httpexceptions import HTTPFound -from pyramid.view import view_config from rhodecode import events from rhodecode.apps._base import RepoAppView @@ -90,9 +89,6 @@ class RepoSettingsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') - @view_config( - route_name='edit_repo', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def edit_settings(self): c = self.load_default_context() c.active = 'settings' @@ -108,9 +104,6 @@ class RepoSettingsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo', request_method='POST', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def edit_settings_update(self): _ = self.request.translate c = self.load_default_context() @@ -192,9 +185,6 @@ class RepoSettingsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.write', 'repository.admin') - @view_config( - route_name='repo_edit_toggle_locking', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def toggle_locking(self): """ Toggle locking of repository by simple GET call to url @@ -224,9 +214,6 @@ class RepoSettingsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') - @view_config( - route_name='edit_repo_statistics', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def edit_statistics_form(self): c = self.load_default_context() @@ -250,9 +237,6 @@ class RepoSettingsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_statistics_reset', request_method='POST', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def repo_statistics_reset(self): _ = self.request.translate diff --git a/rhodecode/apps/repository/views/repo_settings_advanced.py b/rhodecode/apps/repository/views/repo_settings_advanced.py --- a/rhodecode/apps/repository/views/repo_settings_advanced.py +++ b/rhodecode/apps/repository/views/repo_settings_advanced.py @@ -20,7 +20,7 @@ import logging -from pyramid.view import view_config + from pyramid.httpexceptions import HTTPFound from packaging.version import Version @@ -42,7 +42,7 @@ from rhodecode.model.scm import ScmModel log = logging.getLogger(__name__) -class RepoSettingsView(RepoAppView): +class RepoSettingsAdvancedView(RepoAppView): def load_default_context(self): c = self._get_local_tmpl_context() @@ -57,9 +57,6 @@ class RepoSettingsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') - @view_config( - route_name='edit_repo_advanced', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def edit_advanced(self): _ = self.request.translate c = self.load_default_context() @@ -89,9 +86,6 @@ class RepoSettingsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_advanced_archive', request_method='POST', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def edit_advanced_archive(self): """ Archives the repository. It will become read-only, and not visible in search @@ -132,9 +126,6 @@ class RepoSettingsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_advanced_delete', request_method='POST', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def edit_advanced_delete(self): """ Deletes the repository, or shows warnings if deletion is not possible @@ -209,9 +200,6 @@ class RepoSettingsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_advanced_journal', request_method='POST', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def edit_advanced_journal(self): """ Set's this repository to be visible in public journal, @@ -236,9 +224,6 @@ class RepoSettingsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_advanced_fork', request_method='POST', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def edit_advanced_fork(self): """ Mark given repository as a fork of another @@ -281,10 +266,7 @@ class RepoSettingsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_advanced_locking', request_method='POST', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') - def edit_advanced_locking(self): + def edit_advanced_toggle_locking(self): """ Toggle locking of repository """ @@ -309,9 +291,6 @@ class RepoSettingsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') - @view_config( - route_name='edit_repo_advanced_hooks', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def edit_advanced_install_hooks(self): """ Install Hooks for repository diff --git a/rhodecode/apps/repository/views/repo_settings_fields.py b/rhodecode/apps/repository/views/repo_settings_fields.py --- a/rhodecode/apps/repository/views/repo_settings_fields.py +++ b/rhodecode/apps/repository/views/repo_settings_fields.py @@ -24,7 +24,6 @@ import formencode import formencode.htmlfill from pyramid.httpexceptions import HTTPFound -from pyramid.view import view_config from rhodecode.apps._base import RepoAppView from rhodecode.lib import audit_logger @@ -48,9 +47,6 @@ class RepoSettingsFieldsView(RepoAppView @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') - @view_config( - route_name='edit_repo_fields', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def repo_field_edit(self): c = self.load_default_context() @@ -63,9 +59,6 @@ class RepoSettingsFieldsView(RepoAppView @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_fields_create', request_method='POST', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def repo_field_create(self): _ = self.request.translate @@ -94,9 +87,6 @@ class RepoSettingsFieldsView(RepoAppView @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_fields_delete', request_method='POST', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def repo_field_delete(self): _ = self.request.translate field = RepositoryField.get_or_404(self.request.matchdict['field_id']) diff --git a/rhodecode/apps/repository/views/repo_settings_issue_trackers.py b/rhodecode/apps/repository/views/repo_settings_issue_trackers.py --- a/rhodecode/apps/repository/views/repo_settings_issue_trackers.py +++ b/rhodecode/apps/repository/views/repo_settings_issue_trackers.py @@ -21,7 +21,7 @@ import logging from pyramid.httpexceptions import HTTPFound, HTTPNotFound -from pyramid.view import view_config + import formencode from rhodecode.apps._base import RepoAppView @@ -45,9 +45,6 @@ class RepoSettingsIssueTrackersView(Repo @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') - @view_config( - route_name='edit_repo_issuetracker', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def repo_issuetracker(self): c = self.load_default_context() c.active = 'issuetracker' @@ -62,9 +59,6 @@ class RepoSettingsIssueTrackersView(Repo @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_issuetracker_test', request_method='POST', - renderer='string', xhr=True) def repo_issuetracker_test(self): return h.urlify_commit_message( self.request.POST.get('test_text', ''), @@ -73,9 +67,6 @@ class RepoSettingsIssueTrackersView(Repo @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_issuetracker_delete', request_method='POST', - renderer='json_ext', xhr=True) def repo_issuetracker_delete(self): _ = self.request.translate uid = self.request.POST.get('uid') @@ -107,9 +98,6 @@ class RepoSettingsIssueTrackersView(Repo @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_issuetracker_update', request_method='POST', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def repo_issuetracker_update(self): _ = self.request.translate # Save inheritance diff --git a/rhodecode/apps/repository/views/repo_settings_remote.py b/rhodecode/apps/repository/views/repo_settings_remote.py --- a/rhodecode/apps/repository/views/repo_settings_remote.py +++ b/rhodecode/apps/repository/views/repo_settings_remote.py @@ -21,7 +21,7 @@ import logging from pyramid.httpexceptions import HTTPFound -from pyramid.view import view_config + from rhodecode.apps._base import RepoAppView from rhodecode.lib import helpers as h @@ -39,9 +39,6 @@ class RepoSettingsRemoteView(RepoAppView @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') - @view_config( - route_name='edit_repo_remote', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def repo_remote_edit_form(self): c = self.load_default_context() c.active = 'remote' @@ -51,9 +48,6 @@ class RepoSettingsRemoteView(RepoAppView @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_remote_pull', request_method='POST', - renderer=None) def repo_remote_pull_changes(self): _ = self.request.translate self.load_default_context() diff --git a/rhodecode/apps/repository/views/repo_settings_vcs.py b/rhodecode/apps/repository/views/repo_settings_vcs.py --- a/rhodecode/apps/repository/views/repo_settings_vcs.py +++ b/rhodecode/apps/repository/views/repo_settings_vcs.py @@ -25,10 +25,8 @@ import formencode.htmlfill from pyramid.httpexceptions import HTTPFound, HTTPBadRequest from pyramid.response import Response from pyramid.renderers import render -from pyramid.view import view_config from rhodecode.apps._base import RepoAppView -from rhodecode.lib import audit_logger from rhodecode.lib import helpers as h from rhodecode.lib.auth import ( LoginRequired, HasRepoPermissionAnyDecorator, CSRFRequired) @@ -71,9 +69,6 @@ class RepoSettingsVcsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') - @view_config( - route_name='edit_repo_vcs', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def repo_vcs_settings(self): c = self.load_default_context() model = VcsSettingsModel(repo=self.db_repo_name) @@ -100,9 +95,6 @@ class RepoSettingsVcsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_vcs_update', request_method='POST', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def repo_settings_vcs_update(self): _ = self.request.translate c = self.load_default_context() @@ -153,9 +145,6 @@ class RepoSettingsVcsView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='edit_repo_vcs_svn_pattern_delete', request_method='POST', - renderer='json_ext', xhr=True) def repo_settings_delete_svn_pattern(self): self.load_default_context() delete_pattern_id = self.request.POST.get('delete_svn_pattern') diff --git a/rhodecode/apps/repository/views/repo_strip.py b/rhodecode/apps/repository/views/repo_strip.py --- a/rhodecode/apps/repository/views/repo_strip.py +++ b/rhodecode/apps/repository/views/repo_strip.py @@ -19,7 +19,7 @@ # and proprietary license terms, please see https://rhodecode.com/licenses/ import logging -from pyramid.view import view_config + from rhodecode.apps._base import RepoAppView from rhodecode.lib import audit_logger @@ -31,7 +31,7 @@ from rhodecode.lib.ext_json import json log = logging.getLogger(__name__) -class StripView(RepoAppView): +class RepoStripView(RepoAppView): def load_default_context(self): c = self._get_local_tmpl_context() @@ -40,9 +40,6 @@ class StripView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') - @view_config( - route_name='edit_repo_strip', request_method='GET', - renderer='rhodecode:templates/admin/repos/repo_edit.mako') def strip(self): c = self.load_default_context() c.active = 'strip' @@ -53,9 +50,6 @@ class StripView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='strip_check', request_method='POST', - renderer='json', xhr=True) def strip_check(self): from rhodecode.lib.vcs.backends.base import EmptyCommit data = {} @@ -79,9 +73,6 @@ class StripView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator('repository.admin') @CSRFRequired() - @view_config( - route_name='strip_execute', request_method='POST', - renderer='json', xhr=True) def strip_execute(self): from rhodecode.model.scm import ScmModel diff --git a/rhodecode/apps/repository/views/repo_summary.py b/rhodecode/apps/repository/views/repo_summary.py --- a/rhodecode/apps/repository/views/repo_summary.py +++ b/rhodecode/apps/repository/views/repo_summary.py @@ -24,7 +24,7 @@ import time import rhodecode -from pyramid.view import view_config + from rhodecode.lib.view_utils import get_format_ref_id from rhodecode.apps._base import RepoAppView @@ -101,9 +101,6 @@ class RepoSummaryView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_summary_commits', request_method='GET', - renderer='rhodecode:templates/summary/summary_commits.mako') def summary_commits(self): c = self.load_default_context() self._prepare_and_set_clone_url(c) @@ -113,15 +110,6 @@ class RepoSummaryView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_summary', request_method='GET', - renderer='rhodecode:templates/summary/summary.mako') - @view_config( - route_name='repo_summary_slash', request_method='GET', - renderer='rhodecode:templates/summary/summary.mako') - @view_config( - route_name='repo_summary_explicit', request_method='GET', - renderer='rhodecode:templates/summary/summary.mako') def summary(self): c = self.load_default_context() @@ -176,9 +164,6 @@ class RepoSummaryView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_stats', request_method='GET', - renderer='json_ext') def repo_stats(self): show_stats = bool(self.db_repo.enable_statistics) repo_id = self.db_repo.repo_id @@ -228,9 +213,6 @@ class RepoSummaryView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_refs_data', request_method='GET', - renderer='json_ext') def repo_refs_data(self): _ = self.request.translate self.load_default_context() @@ -251,9 +233,6 @@ class RepoSummaryView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='repo_refs_changelog_data', request_method='GET', - renderer='json_ext') def repo_refs_changelog_data(self): _ = self.request.translate self.load_default_context() diff --git a/rhodecode/apps/repository/views/repo_tags.py b/rhodecode/apps/repository/views/repo_tags.py --- a/rhodecode/apps/repository/views/repo_tags.py +++ b/rhodecode/apps/repository/views/repo_tags.py @@ -19,7 +19,6 @@ # and proprietary license terms, please see https://rhodecode.com/licenses/ import logging -from pyramid.view import view_config from rhodecode.apps._base import BaseReferencesView from rhodecode.lib.ext_json import json @@ -33,9 +32,6 @@ class RepoTagsView(BaseReferencesView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='tags_home', request_method='GET', - renderer='rhodecode:templates/tags/tags.mako') def tags(self): c = self.load_default_context() diff --git a/rhodecode/apps/search/__init__.py b/rhodecode/apps/search/__init__.py --- a/rhodecode/apps/search/__init__.py +++ b/rhodecode/apps/search/__init__.py @@ -21,23 +21,42 @@ from rhodecode.apps._base import ADMIN_P def includeme(config): + from rhodecode.apps.search.views import ( + SearchView, SearchRepoView, SearchRepoGroupView) config.add_route( name='search', pattern=ADMIN_PREFIX + '/search') + config.add_view( + SearchView, + attr='search', + route_name='search', request_method='GET', + renderer='rhodecode:templates/search/search.mako') config.add_route( name='search_repo', pattern='/{repo_name:.*?[^/]}/_search', repo_route=True) + config.add_view( + SearchRepoView, + attr='search_repo', + route_name='search_repo', request_method='GET', + renderer='rhodecode:templates/search/search.mako') config.add_route( name='search_repo_alt', pattern='/{repo_name:.*?[^/]}/search', repo_route=True) + config.add_view( + SearchRepoView, + attr='search_repo', + route_name='search_repo_alt', request_method='GET', + renderer='rhodecode:templates/search/search.mako') config.add_route( name='search_repo_group', pattern='/{repo_group_name:.*?[^/]}/_search', repo_group_route=True) - - # Scan module for configuration decorators. - config.scan('.views', ignore='.tests') + config.add_view( + SearchRepoGroupView, + attr='search_repo_group', + route_name='search_repo_group', request_method='GET', + renderer='rhodecode:templates/search/search.mako') diff --git a/rhodecode/apps/search/views.py b/rhodecode/apps/search/views.py --- a/rhodecode/apps/search/views.py +++ b/rhodecode/apps/search/views.py @@ -20,7 +20,7 @@ import logging import urllib -from pyramid.view import view_config + from webhelpers2.html.tools import update_params from rhodecode.apps._base import BaseAppView, RepoAppView, RepoGroupAppView @@ -130,9 +130,6 @@ class SearchView(BaseAppView): return c @LoginRequired() - @view_config( - route_name='search', request_method='GET', - renderer='rhodecode:templates/search/search.mako') def search(self): c = self.load_default_context() perform_search(self.request, c) @@ -148,12 +145,6 @@ class SearchRepoView(RepoAppView): @LoginRequired() @HasRepoPermissionAnyDecorator( 'repository.read', 'repository.write', 'repository.admin') - @view_config( - route_name='search_repo', request_method='GET', - renderer='rhodecode:templates/search/search.mako') - @view_config( - route_name='search_repo_alt', request_method='GET', - renderer='rhodecode:templates/search/search.mako') def search_repo(self): c = self.load_default_context() perform_search(self.request, c, repo_name=self.db_repo_name) @@ -169,9 +160,6 @@ class SearchRepoGroupView(RepoGroupAppVi @LoginRequired() @HasRepoGroupPermissionAnyDecorator( 'group.read', 'group.write', 'group.admin') - @view_config( - route_name='search_repo_group', request_method='GET', - renderer='rhodecode:templates/search/search.mako') def search_repo_group(self): c = self.load_default_context() perform_search(self.request, c, repo_group_name=self.db_repo_group_name) diff --git a/rhodecode/apps/svn_support/__init__.py b/rhodecode/apps/svn_support/__init__.py --- a/rhodecode/apps/svn_support/__init__.py +++ b/rhodecode/apps/svn_support/__init__.py @@ -37,25 +37,6 @@ from . import config_keys log = logging.getLogger(__name__) -def includeme(config): - settings = config.registry.settings - _sanitize_settings_and_apply_defaults(settings) - - if settings[config_keys.generate_config]: - # Add subscriber to generate the Apache mod dav svn configuration on - # repository group events. - config.add_subscriber(generate_config_subscriber, RepoGroupEvent) - - # If a reload command is set add a subscriber to execute it on - # configuration changes. - reload_cmd = settings[config_keys.reload_command] - if reload_cmd: - reload_timeout = settings[config_keys.reload_timeout] or None - reload_subscriber = AsyncSubprocessSubscriber( - cmd=reload_cmd, timeout=reload_timeout) - config.add_subscriber(reload_subscriber, ModDavSvnConfigChange) - - def _sanitize_settings_and_apply_defaults(settings): """ Set defaults, convert to python types and validate settings. @@ -88,3 +69,22 @@ def _append_path_sep(path): if isinstance(path, compat.string_types) and not path.endswith(os.path.sep): path += os.path.sep return path + + +def includeme(config): + settings = config.registry.settings + _sanitize_settings_and_apply_defaults(settings) + + if settings[config_keys.generate_config]: + # Add subscriber to generate the Apache mod dav svn configuration on + # repository group events. + config.add_subscriber(generate_config_subscriber, RepoGroupEvent) + + # If a reload command is set add a subscriber to execute it on + # configuration changes. + reload_cmd = settings[config_keys.reload_command] + if reload_cmd: + reload_timeout = settings[config_keys.reload_timeout] or None + reload_subscriber = AsyncSubprocessSubscriber( + cmd=reload_cmd, timeout=reload_timeout) + config.add_subscriber(reload_subscriber, ModDavSvnConfigChange) diff --git a/rhodecode/apps/user_group/__init__.py b/rhodecode/apps/user_group/__init__.py --- a/rhodecode/apps/user_group/__init__.py +++ b/rhodecode/apps/user_group/__init__.py @@ -28,74 +28,134 @@ def admin_routes(config): """ User groups /_admin prefixed routes """ + from rhodecode.apps.user_group.views import UserGroupsView config.add_route( name='user_group_members_data', pattern='/user_groups/{user_group_id:\d+}/members', user_group_route=True) + config.add_view( + UserGroupsView, + attr='user_group_members', + route_name='user_group_members_data', request_method='GET', + renderer='json_ext', xhr=True) # user groups perms config.add_route( name='edit_user_group_perms_summary', pattern='/user_groups/{user_group_id:\d+}/edit/permissions_summary', user_group_route=True) + config.add_view( + UserGroupsView, + attr='user_group_perms_summary', + route_name='edit_user_group_perms_summary', request_method='GET', + renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') + config.add_route( name='edit_user_group_perms_summary_json', pattern='/user_groups/{user_group_id:\d+}/edit/permissions_summary/json', user_group_route=True) + config.add_view( + UserGroupsView, + attr='user_group_perms_summary_json', + route_name='edit_user_group_perms_summary_json', request_method='GET', + renderer='json_ext') # user groups edit config.add_route( name='edit_user_group', pattern='/user_groups/{user_group_id:\d+}/edit', user_group_route=True) + config.add_view( + UserGroupsView, + attr='user_group_edit', + route_name='edit_user_group', request_method='GET', + renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') # user groups update config.add_route( name='user_groups_update', pattern='/user_groups/{user_group_id:\d+}/update', user_group_route=True) + config.add_view( + UserGroupsView, + attr='user_group_update', + route_name='user_groups_update', request_method='POST', + renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') config.add_route( name='edit_user_group_global_perms', pattern='/user_groups/{user_group_id:\d+}/edit/global_permissions', user_group_route=True) + config.add_view( + UserGroupsView, + attr='user_group_global_perms_edit', + route_name='edit_user_group_global_perms', request_method='GET', + renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') config.add_route( name='edit_user_group_global_perms_update', pattern='/user_groups/{user_group_id:\d+}/edit/global_permissions/update', user_group_route=True) + config.add_view( + UserGroupsView, + attr='user_group_global_perms_update', + route_name='edit_user_group_global_perms_update', request_method='POST', + renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') config.add_route( name='edit_user_group_perms', pattern='/user_groups/{user_group_id:\d+}/edit/permissions', user_group_route=True) + config.add_view( + UserGroupsView, + attr='user_group_edit_perms', + route_name='edit_user_group_perms', request_method='GET', + renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') config.add_route( name='edit_user_group_perms_update', pattern='/user_groups/{user_group_id:\d+}/edit/permissions/update', user_group_route=True) + config.add_view( + UserGroupsView, + attr='user_group_update_perms', + route_name='edit_user_group_perms_update', request_method='POST', + renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') config.add_route( name='edit_user_group_advanced', pattern='/user_groups/{user_group_id:\d+}/edit/advanced', user_group_route=True) + config.add_view( + UserGroupsView, + attr='user_group_edit_advanced', + route_name='edit_user_group_advanced', request_method='GET', + renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') config.add_route( name='edit_user_group_advanced_sync', pattern='/user_groups/{user_group_id:\d+}/edit/advanced/sync', user_group_route=True) + config.add_view( + UserGroupsView, + attr='user_group_edit_advanced_set_synchronization', + route_name='edit_user_group_advanced_sync', request_method='POST', + renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') # user groups delete config.add_route( name='user_groups_delete', pattern='/user_groups/{user_group_id:\d+}/delete', user_group_route=True) + config.add_view( + UserGroupsView, + attr='user_group_delete', + route_name='user_groups_delete', request_method='POST', + renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') def includeme(config): # main admin routes config.include(admin_routes, route_prefix=ADMIN_PREFIX) - # Scan module for configuration decorators. - config.scan('.views', ignore='.tests') diff --git a/rhodecode/apps/user_group/views/__init__.py b/rhodecode/apps/user_group/views/__init__.py --- a/rhodecode/apps/user_group/views/__init__.py +++ b/rhodecode/apps/user_group/views/__init__.py @@ -24,7 +24,7 @@ import peppercorn import formencode import formencode.htmlfill from pyramid.httpexceptions import HTTPFound -from pyramid.view import view_config + from pyramid.response import Response from pyramid.renderers import render @@ -60,9 +60,6 @@ class UserGroupsView(UserGroupAppView): @LoginRequired() @HasUserGroupPermissionAnyDecorator('usergroup.admin') - @view_config( - route_name='user_group_members_data', request_method='GET', - renderer='json_ext', xhr=True) def user_group_members(self): """ Return members of given user group @@ -93,9 +90,6 @@ class UserGroupsView(UserGroupAppView): @LoginRequired() @HasUserGroupPermissionAnyDecorator('usergroup.admin') - @view_config( - route_name='edit_user_group_perms_summary', request_method='GET', - renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') def user_group_perms_summary(self): c = self.load_default_context() c.user_group = self.db_user_group @@ -106,9 +100,6 @@ class UserGroupsView(UserGroupAppView): @LoginRequired() @HasUserGroupPermissionAnyDecorator('usergroup.admin') - @view_config( - route_name='edit_user_group_perms_summary_json', request_method='GET', - renderer='json_ext') def user_group_perms_summary_json(self): self.load_default_context() user_group = self.db_user_group @@ -131,9 +122,6 @@ class UserGroupsView(UserGroupAppView): @LoginRequired() @HasUserGroupPermissionAnyDecorator('usergroup.admin') @CSRFRequired() - @view_config( - route_name='user_groups_update', request_method='POST', - renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') def user_group_update(self): _ = self.request.translate @@ -230,9 +218,6 @@ class UserGroupsView(UserGroupAppView): @LoginRequired() @HasUserGroupPermissionAnyDecorator('usergroup.admin') @CSRFRequired() - @view_config( - route_name='user_groups_delete', request_method='POST', - renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') def user_group_delete(self): _ = self.request.translate user_group = self.db_user_group @@ -258,9 +243,6 @@ class UserGroupsView(UserGroupAppView): @LoginRequired() @HasUserGroupPermissionAnyDecorator('usergroup.admin') - @view_config( - route_name='edit_user_group', request_method='GET', - renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') def user_group_edit(self): user_group = self.db_user_group @@ -293,9 +275,6 @@ class UserGroupsView(UserGroupAppView): @LoginRequired() @HasUserGroupPermissionAnyDecorator('usergroup.admin') - @view_config( - route_name='edit_user_group_perms', request_method='GET', - renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') def user_group_edit_perms(self): user_group = self.db_user_group c = self.load_default_context() @@ -326,9 +305,6 @@ class UserGroupsView(UserGroupAppView): @LoginRequired() @HasUserGroupPermissionAnyDecorator('usergroup.admin') @CSRFRequired() - @view_config( - route_name='edit_user_group_perms_update', request_method='POST', - renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') def user_group_update_perms(self): """ grant permission for given user group @@ -390,9 +366,6 @@ class UserGroupsView(UserGroupAppView): @LoginRequired() @HasUserGroupPermissionAnyDecorator('usergroup.admin') - @view_config( - route_name='edit_user_group_global_perms', request_method='GET', - renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') def user_group_global_perms_edit(self): user_group = self.db_user_group c = self.load_default_context() @@ -418,9 +391,6 @@ class UserGroupsView(UserGroupAppView): @LoginRequired() @HasUserGroupPermissionAnyDecorator('usergroup.admin') @CSRFRequired() - @view_config( - route_name='edit_user_group_global_perms_update', request_method='POST', - renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') def user_group_global_perms_update(self): _ = self.request.translate user_group = self.db_user_group @@ -485,9 +455,6 @@ class UserGroupsView(UserGroupAppView): @LoginRequired() @HasUserGroupPermissionAnyDecorator('usergroup.admin') - @view_config( - route_name='edit_user_group_advanced', request_method='GET', - renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') def user_group_edit_advanced(self): user_group = self.db_user_group @@ -515,9 +482,6 @@ class UserGroupsView(UserGroupAppView): @LoginRequired() @HasUserGroupPermissionAnyDecorator('usergroup.admin') @CSRFRequired() - @view_config( - route_name='edit_user_group_advanced_sync', request_method='POST', - renderer='rhodecode:templates/admin/user_groups/user_group_edit.mako') def user_group_edit_advanced_set_synchronization(self): _ = self.request.translate user_group = self.db_user_group diff --git a/rhodecode/apps/user_group_profile/__init__.py b/rhodecode/apps/user_group_profile/__init__.py --- a/rhodecode/apps/user_group_profile/__init__.py +++ b/rhodecode/apps/user_group_profile/__init__.py @@ -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') diff --git a/rhodecode/apps/user_group_profile/views.py b/rhodecode/apps/user_group_profile/views.py --- a/rhodecode/apps/user_group_profile/views.py +++ b/rhodecode/apps/user_group_profile/views.py @@ -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' diff --git a/rhodecode/apps/user_profile/__init__.py b/rhodecode/apps/user_profile/__init__.py --- a/rhodecode/apps/user_profile/__init__.py +++ b/rhodecode/apps/user_profile/__init__.py @@ -20,9 +20,13 @@ def includeme(config): + from rhodecode.apps.user_profile.views import UserProfileView + config.add_route( name='user_profile', pattern='/_profiles/{username}') - - # Scan module for configuration decorators. - config.scan('.views', ignore='.tests') + config.add_view( + UserProfileView, + attr='user_profile', + route_name='user_profile', request_method='GET', + renderer='rhodecode:templates/users/user.mako') diff --git a/rhodecode/apps/user_profile/views.py b/rhodecode/apps/user_profile/views.py --- a/rhodecode/apps/user_profile/views.py +++ b/rhodecode/apps/user_profile/views.py @@ -21,7 +21,6 @@ import logging from pyramid.httpexceptions import HTTPNotFound -from pyramid.view import view_config from rhodecode.apps._base import BaseAppView from rhodecode.lib.auth import LoginRequired, NotAnonymous @@ -36,9 +35,6 @@ class UserProfileView(BaseAppView): @LoginRequired() @NotAnonymous() - @view_config( - route_name='user_profile', request_method='GET', - renderer='rhodecode:templates/users/user.mako') def user_profile(self): # register local template context c = self._get_local_tmpl_context() diff --git a/rhodecode/config/jsroutes.py b/rhodecode/config/jsroutes.py --- a/rhodecode/config/jsroutes.py +++ b/rhodecode/config/jsroutes.py @@ -20,7 +20,7 @@ def generate_jsroutes_content(jsroutes): statements = [] - for url_name, url, fields in jsroutes: + for url_name, url, fields in sorted(jsroutes): statements.append( "pyroutes.register('%s', '%s', %s);" % (url_name, url, fields)) return u''' diff --git a/rhodecode/config/middleware.py b/rhodecode/config/middleware.py --- a/rhodecode/config/middleware.py +++ b/rhodecode/config/middleware.py @@ -92,6 +92,7 @@ def make_pyramid_app(global_config, **se # Allows to use format style "{ENV_NAME}" placeholders in the configuration. It # will be replaced by the value of the environment variable "NAME" in this case. start_time = time.time() + log.info('Pyramid app config starting') debug = asbool(global_config.get('debug')) if debug: @@ -121,6 +122,7 @@ def make_pyramid_app(global_config, **se pyramid_app.config = config config.configure_celery(global_config['__file__']) + # creating the app uses a connection - return it after we are done meta.Session.remove() total_time = time.time() - start_time @@ -256,16 +258,12 @@ def includeme(config, auth_resources=Non config.include('pyramid_mako') config.include('rhodecode.lib.rc_beaker') config.include('rhodecode.lib.rc_cache') - config.include('rhodecode.apps._base.navigation') config.include('rhodecode.apps._base.subscribers') config.include('rhodecode.tweens') config.include('rhodecode.authentication') if load_all: - config.include('rhodecode.integrations') - - if load_all: ce_auth_resources = [ 'rhodecode.authentication.plugins.auth_crowd', 'rhodecode.authentication.plugins.auth_headers', @@ -291,15 +289,17 @@ def includeme(config, auth_resources=Non # apps if load_all: + config.include('rhodecode.api') config.include('rhodecode.apps._base') config.include('rhodecode.apps.hovercards') config.include('rhodecode.apps.ops') - config.include('rhodecode.apps.admin') config.include('rhodecode.apps.channelstream') config.include('rhodecode.apps.file_store') + config.include('rhodecode.apps.admin') config.include('rhodecode.apps.login') config.include('rhodecode.apps.home') config.include('rhodecode.apps.journal') + config.include('rhodecode.apps.repository') config.include('rhodecode.apps.repo_group') config.include('rhodecode.apps.user_group') @@ -307,11 +307,14 @@ def includeme(config, auth_resources=Non config.include('rhodecode.apps.user_profile') config.include('rhodecode.apps.user_group_profile') config.include('rhodecode.apps.my_account') + config.include('rhodecode.apps.gist') + config.include('rhodecode.apps.svn_support') config.include('rhodecode.apps.ssh_support') - config.include('rhodecode.apps.gist') config.include('rhodecode.apps.debug_style') - config.include('rhodecode.api') + + if load_all: + config.include('rhodecode.integrations') config.add_route('rhodecode_support', 'https://rhodecode.com/help/', static=True) config.add_translation_dirs('rhodecode:i18n/') diff --git a/rhodecode/integrations/routes.py b/rhodecode/integrations/routes.py --- a/rhodecode/integrations/routes.py +++ b/rhodecode/integrations/routes.py @@ -24,6 +24,9 @@ from rhodecode.apps._base import ADMIN_P from rhodecode.lib.utils2 import safe_int from rhodecode.model.db import Repository, Integration, RepoGroup from rhodecode.integrations import integration_type_registry +from rhodecode.integrations.views import GlobalIntegrationsView +from rhodecode.integrations.views import RepoGroupIntegrationsView +from rhodecode.integrations.views import RepoIntegrationsView log = logging.getLogger(__name__) @@ -83,7 +86,7 @@ def includeme(config): # global integrations config.add_route('global_integrations_new', ADMIN_PREFIX + '/integrations/new') - config.add_view('rhodecode.integrations.views.GlobalIntegrationsView', + config.add_view(GlobalIntegrationsView, attr='new_integration', renderer='rhodecode:templates/admin/integrations/new.mako', request_method='GET', @@ -94,7 +97,7 @@ def includeme(config): config.add_route('global_integrations_list', ADMIN_PREFIX + '/integrations/{integration}') for route_name in ['global_integrations_home', 'global_integrations_list']: - config.add_view('rhodecode.integrations.views.GlobalIntegrationsView', + config.add_view(GlobalIntegrationsView, attr='integration_list', renderer='rhodecode:templates/admin/integrations/list.mako', request_method='GET', @@ -108,12 +111,12 @@ def includeme(config): valid_integration=True) for route_name in ['global_integrations_create', 'global_integrations_edit']: - config.add_view('rhodecode.integrations.views.GlobalIntegrationsView', + config.add_view(GlobalIntegrationsView, attr='settings_get', renderer='rhodecode:templates/admin/integrations/form.mako', request_method='GET', route_name=route_name) - config.add_view('rhodecode.integrations.views.GlobalIntegrationsView', + config.add_view(GlobalIntegrationsView, attr='settings_post', renderer='rhodecode:templates/admin/integrations/form.mako', request_method='POST', @@ -124,7 +127,7 @@ def includeme(config): add_route_requirements('/{repo_group_name}/_settings/integrations'), repo_group_route=True) - config.add_view('rhodecode.integrations.views.RepoGroupIntegrationsView', + config.add_view(RepoGroupIntegrationsView, attr='integration_list', renderer='rhodecode:templates/admin/integrations/list.mako', request_method='GET', @@ -133,7 +136,7 @@ def includeme(config): config.add_route('repo_group_integrations_new', add_route_requirements('/{repo_group_name}/_settings/integrations/new'), repo_group_route=True) - config.add_view('rhodecode.integrations.views.RepoGroupIntegrationsView', + config.add_view(RepoGroupIntegrationsView, attr='new_integration', renderer='rhodecode:templates/admin/integrations/new.mako', request_method='GET', @@ -143,7 +146,7 @@ def includeme(config): add_route_requirements('/{repo_group_name}/_settings/integrations/{integration}'), repo_group_route=True, valid_integration=True) - config.add_view('rhodecode.integrations.views.RepoGroupIntegrationsView', + config.add_view(RepoGroupIntegrationsView, attr='integration_list', renderer='rhodecode:templates/admin/integrations/list.mako', request_method='GET', @@ -153,12 +156,12 @@ def includeme(config): add_route_requirements('/{repo_group_name}/_settings/integrations/{integration}/new'), repo_group_route=True, valid_integration=True) - config.add_view('rhodecode.integrations.views.RepoGroupIntegrationsView', + config.add_view(RepoGroupIntegrationsView, attr='settings_get', renderer='rhodecode:templates/admin/integrations/form.mako', request_method='GET', route_name='repo_group_integrations_create') - config.add_view('rhodecode.integrations.views.RepoGroupIntegrationsView', + config.add_view(RepoGroupIntegrationsView, attr='settings_post', renderer='rhodecode:templates/admin/integrations/form.mako', request_method='POST', @@ -169,12 +172,12 @@ def includeme(config): repo_group_route=True, valid_integration=True) - config.add_view('rhodecode.integrations.views.RepoGroupIntegrationsView', + config.add_view(RepoGroupIntegrationsView, attr='settings_get', renderer='rhodecode:templates/admin/integrations/form.mako', request_method='GET', route_name='repo_group_integrations_edit') - config.add_view('rhodecode.integrations.views.RepoGroupIntegrationsView', + config.add_view(RepoGroupIntegrationsView, attr='settings_post', renderer='rhodecode:templates/admin/integrations/form.mako', request_method='POST', @@ -184,7 +187,7 @@ def includeme(config): config.add_route('repo_integrations_home', add_route_requirements('/{repo_name}/settings/integrations'), repo_route=True) - config.add_view('rhodecode.integrations.views.RepoIntegrationsView', + config.add_view(RepoIntegrationsView, attr='integration_list', request_method='GET', renderer='rhodecode:templates/admin/integrations/list.mako', @@ -193,7 +196,7 @@ def includeme(config): config.add_route('repo_integrations_new', add_route_requirements('/{repo_name}/settings/integrations/new'), repo_route=True) - config.add_view('rhodecode.integrations.views.RepoIntegrationsView', + config.add_view(RepoIntegrationsView, attr='new_integration', renderer='rhodecode:templates/admin/integrations/new.mako', request_method='GET', @@ -203,7 +206,7 @@ def includeme(config): add_route_requirements('/{repo_name}/settings/integrations/{integration}'), repo_route=True, valid_integration=True) - config.add_view('rhodecode.integrations.views.RepoIntegrationsView', + config.add_view(RepoIntegrationsView, attr='integration_list', request_method='GET', renderer='rhodecode:templates/admin/integrations/list.mako', @@ -213,12 +216,12 @@ def includeme(config): add_route_requirements('/{repo_name}/settings/integrations/{integration}/new'), repo_route=True, valid_integration=True) - config.add_view('rhodecode.integrations.views.RepoIntegrationsView', + config.add_view(RepoIntegrationsView, attr='settings_get', renderer='rhodecode:templates/admin/integrations/form.mako', request_method='GET', route_name='repo_integrations_create') - config.add_view('rhodecode.integrations.views.RepoIntegrationsView', + config.add_view(RepoIntegrationsView, attr='settings_post', renderer='rhodecode:templates/admin/integrations/form.mako', request_method='POST', @@ -228,12 +231,12 @@ def includeme(config): add_route_requirements('/{repo_name}/settings/integrations/{integration}/{integration_id}'), repo_route=True, valid_integration=True) - config.add_view('rhodecode.integrations.views.RepoIntegrationsView', + config.add_view(RepoIntegrationsView, attr='settings_get', renderer='rhodecode:templates/admin/integrations/form.mako', request_method='GET', route_name='repo_integrations_edit') - config.add_view('rhodecode.integrations.views.RepoIntegrationsView', + config.add_view(RepoIntegrationsView, attr='settings_post', renderer='rhodecode:templates/admin/integrations/form.mako', request_method='POST', diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -4810,6 +4810,7 @@ class Gist(Base, BaseModel): res = cls.query().filter(cls.gist_access_id == id_).scalar() if not res: + log.debug('WARN: No DB entry with id %s', id_) raise HTTPNotFound() return res diff --git a/rhodecode/public/js/rhodecode/routes.js b/rhodecode/public/js/rhodecode/routes.js --- a/rhodecode/public/js/rhodecode/routes.js +++ b/rhodecode/public/js/rhodecode/routes.js @@ -12,394 +12,392 @@ ******************************************************************************/ function registerRCRoutes() { // routes registration - pyroutes.register('favicon', '/favicon.ico', []); - pyroutes.register('robots', '/robots.txt', []); - pyroutes.register('auth_home', '/_admin/auth*traverse', []); - pyroutes.register('global_integrations_new', '/_admin/integrations/new', []); - pyroutes.register('global_integrations_home', '/_admin/integrations', []); - pyroutes.register('global_integrations_list', '/_admin/integrations/%(integration)s', ['integration']); - pyroutes.register('global_integrations_create', '/_admin/integrations/%(integration)s/new', ['integration']); - pyroutes.register('global_integrations_edit', '/_admin/integrations/%(integration)s/%(integration_id)s', ['integration', 'integration_id']); - pyroutes.register('repo_group_integrations_home', '/%(repo_group_name)s/_settings/integrations', ['repo_group_name']); - pyroutes.register('repo_group_integrations_new', '/%(repo_group_name)s/_settings/integrations/new', ['repo_group_name']); - pyroutes.register('repo_group_integrations_list', '/%(repo_group_name)s/_settings/integrations/%(integration)s', ['repo_group_name', 'integration']); - pyroutes.register('repo_group_integrations_create', '/%(repo_group_name)s/_settings/integrations/%(integration)s/new', ['repo_group_name', 'integration']); - pyroutes.register('repo_group_integrations_edit', '/%(repo_group_name)s/_settings/integrations/%(integration)s/%(integration_id)s', ['repo_group_name', 'integration', 'integration_id']); - pyroutes.register('repo_integrations_home', '/%(repo_name)s/settings/integrations', ['repo_name']); - pyroutes.register('repo_integrations_new', '/%(repo_name)s/settings/integrations/new', ['repo_name']); - pyroutes.register('repo_integrations_list', '/%(repo_name)s/settings/integrations/%(integration)s', ['repo_name', 'integration']); - pyroutes.register('repo_integrations_create', '/%(repo_name)s/settings/integrations/%(integration)s/new', ['repo_name', 'integration']); - pyroutes.register('repo_integrations_edit', '/%(repo_name)s/settings/integrations/%(integration)s/%(integration_id)s', ['repo_name', 'integration', 'integration_id']); - pyroutes.register('hovercard_user', '/_hovercard/user/%(user_id)s', ['user_id']); - pyroutes.register('hovercard_username', '/_hovercard/username/%(username)s', ['username']); - pyroutes.register('hovercard_user_group', '/_hovercard/user_group/%(user_group_id)s', ['user_group_id']); - pyroutes.register('hovercard_pull_request', '/_hovercard/pull_request/%(pull_request_id)s', ['pull_request_id']); - pyroutes.register('hovercard_repo_commit', '/_hovercard/commit/%(repo_name)s/%(commit_id)s', ['repo_name', 'commit_id']); - pyroutes.register('ops_ping', '/_admin/ops/ping', []); - pyroutes.register('ops_error_test', '/_admin/ops/error', []); - pyroutes.register('ops_redirect_test', '/_admin/ops/redirect', []); - pyroutes.register('ops_ping_legacy', '/_admin/ping', []); - pyroutes.register('ops_error_test_legacy', '/_admin/error_test', []); - pyroutes.register('admin_home', '/_admin', []); + pyroutes.register('admin_audit_log_entry', '/_admin/audit_logs/%(audit_log_id)s', ['audit_log_id']); pyroutes.register('admin_audit_logs', '/_admin/audit_logs', []); - pyroutes.register('admin_audit_log_entry', '/_admin/audit_logs/%(audit_log_id)s', ['audit_log_id']); - pyroutes.register('pull_requests_global_0', '/_admin/pull_requests/%(pull_request_id)s', ['pull_request_id']); - pyroutes.register('pull_requests_global_1', '/_admin/pull-requests/%(pull_request_id)s', ['pull_request_id']); - pyroutes.register('pull_requests_global', '/_admin/pull-request/%(pull_request_id)s', ['pull_request_id']); - pyroutes.register('admin_settings_open_source', '/_admin/settings/open_source', []); - pyroutes.register('admin_settings_vcs_svn_generate_cfg', '/_admin/settings/vcs/svn_generate_cfg', []); - pyroutes.register('admin_settings_system', '/_admin/settings/system', []); - pyroutes.register('admin_settings_system_update', '/_admin/settings/system/updates', []); - pyroutes.register('admin_settings_exception_tracker', '/_admin/settings/exceptions', []); - pyroutes.register('admin_settings_exception_tracker_delete_all', '/_admin/settings/exceptions/delete', []); - pyroutes.register('admin_settings_exception_tracker_show', '/_admin/settings/exceptions/%(exception_id)s', ['exception_id']); - pyroutes.register('admin_settings_exception_tracker_delete', '/_admin/settings/exceptions/%(exception_id)s/delete', ['exception_id']); - pyroutes.register('admin_settings_sessions', '/_admin/settings/sessions', []); - pyroutes.register('admin_settings_sessions_cleanup', '/_admin/settings/sessions/cleanup', []); - pyroutes.register('admin_settings_process_management', '/_admin/settings/process_management', []); - pyroutes.register('admin_settings_process_management_data', '/_admin/settings/process_management/data', []); - pyroutes.register('admin_settings_process_management_signal', '/_admin/settings/process_management/signal', []); - pyroutes.register('admin_settings_process_management_master_signal', '/_admin/settings/process_management/master_signal', []); pyroutes.register('admin_defaults_repositories', '/_admin/defaults/repositories', []); pyroutes.register('admin_defaults_repositories_update', '/_admin/defaults/repositories/update', []); - pyroutes.register('admin_settings', '/_admin/settings', []); - pyroutes.register('admin_settings_update', '/_admin/settings/update', []); - pyroutes.register('admin_settings_global', '/_admin/settings/global', []); - pyroutes.register('admin_settings_global_update', '/_admin/settings/global/update', []); - pyroutes.register('admin_settings_vcs', '/_admin/settings/vcs', []); - pyroutes.register('admin_settings_vcs_update', '/_admin/settings/vcs/update', []); - pyroutes.register('admin_settings_vcs_svn_pattern_delete', '/_admin/settings/vcs/svn_pattern_delete', []); - pyroutes.register('admin_settings_mapping', '/_admin/settings/mapping', []); - pyroutes.register('admin_settings_mapping_update', '/_admin/settings/mapping/update', []); - pyroutes.register('admin_settings_visual', '/_admin/settings/visual', []); - pyroutes.register('admin_settings_visual_update', '/_admin/settings/visual/update', []); - pyroutes.register('admin_settings_issuetracker', '/_admin/settings/issue-tracker', []); - pyroutes.register('admin_settings_issuetracker_update', '/_admin/settings/issue-tracker/update', []); - pyroutes.register('admin_settings_issuetracker_test', '/_admin/settings/issue-tracker/test', []); - pyroutes.register('admin_settings_issuetracker_delete', '/_admin/settings/issue-tracker/delete', []); - pyroutes.register('admin_settings_email', '/_admin/settings/email', []); - pyroutes.register('admin_settings_email_update', '/_admin/settings/email/update', []); - pyroutes.register('admin_settings_hooks', '/_admin/settings/hooks', []); - pyroutes.register('admin_settings_hooks_update', '/_admin/settings/hooks/update', []); - pyroutes.register('admin_settings_hooks_delete', '/_admin/settings/hooks/delete', []); - pyroutes.register('admin_settings_search', '/_admin/settings/search', []); - pyroutes.register('admin_settings_labs', '/_admin/settings/labs', []); - pyroutes.register('admin_settings_labs_update', '/_admin/settings/labs/update', []); + pyroutes.register('admin_home', '/_admin', []); pyroutes.register('admin_permissions_application', '/_admin/permissions/application', []); pyroutes.register('admin_permissions_application_update', '/_admin/permissions/application/update', []); + pyroutes.register('admin_permissions_auth_token_access', '/_admin/permissions/auth_token_access', []); + pyroutes.register('admin_permissions_branch', '/_admin/permissions/branch', []); + pyroutes.register('admin_permissions_branch_update', '/_admin/permissions/branch/update', []); pyroutes.register('admin_permissions_global', '/_admin/permissions/global', []); pyroutes.register('admin_permissions_global_update', '/_admin/permissions/global/update', []); + pyroutes.register('admin_permissions_ips', '/_admin/permissions/ips', []); pyroutes.register('admin_permissions_object', '/_admin/permissions/object', []); pyroutes.register('admin_permissions_object_update', '/_admin/permissions/object/update', []); - pyroutes.register('admin_permissions_ips', '/_admin/permissions/ips', []); pyroutes.register('admin_permissions_overview', '/_admin/permissions/overview', []); - pyroutes.register('admin_permissions_auth_token_access', '/_admin/permissions/auth_token_access', []); pyroutes.register('admin_permissions_ssh_keys', '/_admin/permissions/ssh_keys', []); pyroutes.register('admin_permissions_ssh_keys_data', '/_admin/permissions/ssh_keys/data', []); pyroutes.register('admin_permissions_ssh_keys_update', '/_admin/permissions/ssh_keys/update', []); - pyroutes.register('users', '/_admin/users', []); - pyroutes.register('users_data', '/_admin/users_data', []); - pyroutes.register('users_create', '/_admin/users/create', []); - pyroutes.register('users_new', '/_admin/users/new', []); - pyroutes.register('user_edit', '/_admin/users/%(user_id)s/edit', ['user_id']); - pyroutes.register('user_edit_advanced', '/_admin/users/%(user_id)s/edit/advanced', ['user_id']); - pyroutes.register('user_edit_global_perms', '/_admin/users/%(user_id)s/edit/global_permissions', ['user_id']); - pyroutes.register('user_edit_global_perms_update', '/_admin/users/%(user_id)s/edit/global_permissions/update', ['user_id']); - pyroutes.register('user_update', '/_admin/users/%(user_id)s/update', ['user_id']); - pyroutes.register('user_delete', '/_admin/users/%(user_id)s/delete', ['user_id']); - pyroutes.register('user_enable_force_password_reset', '/_admin/users/%(user_id)s/password_reset_enable', ['user_id']); - pyroutes.register('user_disable_force_password_reset', '/_admin/users/%(user_id)s/password_reset_disable', ['user_id']); - pyroutes.register('user_create_personal_repo_group', '/_admin/users/%(user_id)s/create_repo_group', ['user_id']); - pyroutes.register('user_notice_dismiss', '/_admin/users/%(user_id)s/notice_dismiss', ['user_id']); + pyroutes.register('admin_settings', '/_admin/settings', []); + pyroutes.register('admin_settings_automation', '/_admin/settings/automation', []); + pyroutes.register('admin_settings_automation_update', '/_admin/settings/automation/%(entry_id)s/update', ['entry_id']); + pyroutes.register('admin_settings_email', '/_admin/settings/email', []); + pyroutes.register('admin_settings_email_update', '/_admin/settings/email/update', []); + pyroutes.register('admin_settings_exception_tracker', '/_admin/settings/exceptions', []); + pyroutes.register('admin_settings_exception_tracker_delete', '/_admin/settings/exceptions/%(exception_id)s/delete', ['exception_id']); + pyroutes.register('admin_settings_exception_tracker_delete_all', '/_admin/settings/exceptions_delete_all', []); + pyroutes.register('admin_settings_exception_tracker_show', '/_admin/settings/exceptions/%(exception_id)s', ['exception_id']); + pyroutes.register('admin_settings_global', '/_admin/settings/global', []); + pyroutes.register('admin_settings_global_update', '/_admin/settings/global/update', []); + pyroutes.register('admin_settings_hooks', '/_admin/settings/hooks', []); + pyroutes.register('admin_settings_hooks_delete', '/_admin/settings/hooks/delete', []); + pyroutes.register('admin_settings_hooks_update', '/_admin/settings/hooks/update', []); + pyroutes.register('admin_settings_issuetracker', '/_admin/settings/issue-tracker', []); + pyroutes.register('admin_settings_issuetracker_delete', '/_admin/settings/issue-tracker/delete', []); + pyroutes.register('admin_settings_issuetracker_test', '/_admin/settings/issue-tracker/test', []); + pyroutes.register('admin_settings_issuetracker_update', '/_admin/settings/issue-tracker/update', []); + pyroutes.register('admin_settings_labs', '/_admin/settings/labs', []); + pyroutes.register('admin_settings_labs_update', '/_admin/settings/labs/update', []); + pyroutes.register('admin_settings_license', '/_admin/settings/license', []); + pyroutes.register('admin_settings_license_unlock', '/_admin/settings/license_unlock', []); + pyroutes.register('admin_settings_mapping', '/_admin/settings/mapping', []); + pyroutes.register('admin_settings_mapping_update', '/_admin/settings/mapping/update', []); + pyroutes.register('admin_settings_open_source', '/_admin/settings/open_source', []); + pyroutes.register('admin_settings_process_management', '/_admin/settings/process_management', []); + pyroutes.register('admin_settings_process_management_data', '/_admin/settings/process_management/data', []); + pyroutes.register('admin_settings_process_management_master_signal', '/_admin/settings/process_management/master_signal', []); + pyroutes.register('admin_settings_process_management_signal', '/_admin/settings/process_management/signal', []); + pyroutes.register('admin_settings_scheduler_create', '/_admin/settings/scheduler/create', []); + pyroutes.register('admin_settings_scheduler_delete', '/_admin/settings/scheduler/%(schedule_id)s/delete', ['schedule_id']); + pyroutes.register('admin_settings_scheduler_edit', '/_admin/settings/scheduler/%(schedule_id)s', ['schedule_id']); + pyroutes.register('admin_settings_scheduler_execute', '/_admin/settings/scheduler/%(schedule_id)s/execute', ['schedule_id']); + pyroutes.register('admin_settings_scheduler_new', '/_admin/settings/scheduler/new', []); + pyroutes.register('admin_settings_scheduler_show_all', '/_admin/settings/scheduler', []); + pyroutes.register('admin_settings_scheduler_show_tasks', '/_admin/settings/scheduler/_tasks', []); + pyroutes.register('admin_settings_scheduler_update', '/_admin/settings/scheduler/%(schedule_id)s/update', ['schedule_id']); + pyroutes.register('admin_settings_search', '/_admin/settings/search', []); + pyroutes.register('admin_settings_sessions', '/_admin/settings/sessions', []); + pyroutes.register('admin_settings_sessions_cleanup', '/_admin/settings/sessions/cleanup', []); + pyroutes.register('admin_settings_system', '/_admin/settings/system', []); + pyroutes.register('admin_settings_system_update', '/_admin/settings/system/updates', []); + pyroutes.register('admin_settings_update', '/_admin/settings/update', []); + pyroutes.register('admin_settings_vcs', '/_admin/settings/vcs', []); + pyroutes.register('admin_settings_vcs_svn_generate_cfg', '/_admin/settings/vcs/svn_generate_cfg', []); + pyroutes.register('admin_settings_vcs_svn_pattern_delete', '/_admin/settings/vcs/svn_pattern_delete', []); + pyroutes.register('admin_settings_vcs_update', '/_admin/settings/vcs/update', []); + pyroutes.register('admin_settings_visual', '/_admin/settings/visual', []); + pyroutes.register('admin_settings_visual_update', '/_admin/settings/visual/update', []); + pyroutes.register('apiv2', '/_admin/api', []); + pyroutes.register('atom_feed_home', '/%(repo_name)s/feed-atom', ['repo_name']); + pyroutes.register('atom_feed_home_old', '/%(repo_name)s/feed/atom', ['repo_name']); + pyroutes.register('auth_home', '/_admin/auth*traverse', []); + pyroutes.register('bookmarks_home', '/%(repo_name)s/bookmarks', ['repo_name']); + pyroutes.register('branches_home', '/%(repo_name)s/branches', ['repo_name']); + pyroutes.register('channelstream_connect', '/_admin/channelstream/connect', []); + pyroutes.register('channelstream_proxy', '/_channelstream', []); + pyroutes.register('channelstream_subscribe', '/_admin/channelstream/subscribe', []); + pyroutes.register('commit_draft_comments_submit', '/%(repo_name)s/changeset/%(commit_id)s/draft_comments_submit', ['repo_name', 'commit_id']); + pyroutes.register('debug_style_email', '/_admin/debug_style/email/%(email_id)s', ['email_id']); + pyroutes.register('debug_style_email_plain_rendered', '/_admin/debug_style/email-rendered/%(email_id)s', ['email_id']); + pyroutes.register('debug_style_home', '/_admin/debug_style', []); + pyroutes.register('debug_style_template', '/_admin/debug_style/t/%(t_path)s', ['t_path']); + pyroutes.register('download_file', '/_file_store/download/%(fid)s', ['fid']); + pyroutes.register('download_file_by_token', '/_file_store/token-download/%(_auth_token)s/%(fid)s', ['_auth_token', 'fid']); + pyroutes.register('edit_repo', '/%(repo_name)s/settings', ['repo_name']); + pyroutes.register('edit_repo_advanced', '/%(repo_name)s/settings/advanced', ['repo_name']); + pyroutes.register('edit_repo_advanced_archive', '/%(repo_name)s/settings/advanced/archive', ['repo_name']); + pyroutes.register('edit_repo_advanced_delete', '/%(repo_name)s/settings/advanced/delete', ['repo_name']); + pyroutes.register('edit_repo_advanced_fork', '/%(repo_name)s/settings/advanced/fork', ['repo_name']); + pyroutes.register('edit_repo_advanced_hooks', '/%(repo_name)s/settings/advanced/hooks', ['repo_name']); + pyroutes.register('edit_repo_advanced_journal', '/%(repo_name)s/settings/advanced/journal', ['repo_name']); + pyroutes.register('edit_repo_advanced_locking', '/%(repo_name)s/settings/advanced/locking', ['repo_name']); + pyroutes.register('edit_repo_audit_logs', '/%(repo_name)s/settings/audit_logs', ['repo_name']); + pyroutes.register('edit_repo_caches', '/%(repo_name)s/settings/caches', ['repo_name']); + pyroutes.register('edit_repo_fields', '/%(repo_name)s/settings/fields', ['repo_name']); + pyroutes.register('edit_repo_fields_create', '/%(repo_name)s/settings/fields/create', ['repo_name']); + pyroutes.register('edit_repo_fields_delete', '/%(repo_name)s/settings/fields/%(field_id)s/delete', ['repo_name', 'field_id']); + pyroutes.register('edit_repo_group', '/%(repo_group_name)s/_edit', ['repo_group_name']); + pyroutes.register('edit_repo_group_advanced', '/%(repo_group_name)s/_settings/advanced', ['repo_group_name']); + pyroutes.register('edit_repo_group_advanced_delete', '/%(repo_group_name)s/_settings/advanced/delete', ['repo_group_name']); + pyroutes.register('edit_repo_group_perms', '/%(repo_group_name)s/_settings/permissions', ['repo_group_name']); + pyroutes.register('edit_repo_group_perms_update', '/%(repo_group_name)s/_settings/permissions/update', ['repo_group_name']); + pyroutes.register('edit_repo_issuetracker', '/%(repo_name)s/settings/issue_trackers', ['repo_name']); + pyroutes.register('edit_repo_issuetracker_delete', '/%(repo_name)s/settings/issue_trackers/delete', ['repo_name']); + pyroutes.register('edit_repo_issuetracker_test', '/%(repo_name)s/settings/issue_trackers/test', ['repo_name']); + pyroutes.register('edit_repo_issuetracker_update', '/%(repo_name)s/settings/issue_trackers/update', ['repo_name']); + pyroutes.register('edit_repo_maintenance', '/%(repo_name)s/settings/maintenance', ['repo_name']); + pyroutes.register('edit_repo_maintenance_execute', '/%(repo_name)s/settings/maintenance/execute', ['repo_name']); + pyroutes.register('edit_repo_perms', '/%(repo_name)s/settings/permissions', ['repo_name']); + pyroutes.register('edit_repo_perms_branch', '/%(repo_name)s/settings/branch_permissions', ['repo_name']); + pyroutes.register('edit_repo_perms_branch_delete', '/%(repo_name)s/settings/branch_permissions/%(rule_id)s/delete', ['repo_name', 'rule_id']); + pyroutes.register('edit_repo_perms_set_private', '/%(repo_name)s/settings/permissions/set_private', ['repo_name']); + pyroutes.register('edit_repo_remote', '/%(repo_name)s/settings/remote', ['repo_name']); + pyroutes.register('edit_repo_remote_pull', '/%(repo_name)s/settings/remote/pull', ['repo_name']); + pyroutes.register('edit_repo_remote_push', '/%(repo_name)s/settings/remote/push', ['repo_name']); + pyroutes.register('edit_repo_statistics', '/%(repo_name)s/settings/statistics', ['repo_name']); + pyroutes.register('edit_repo_statistics_reset', '/%(repo_name)s/settings/statistics/update', ['repo_name']); + pyroutes.register('edit_repo_strip', '/%(repo_name)s/settings/strip', ['repo_name']); + pyroutes.register('edit_repo_vcs', '/%(repo_name)s/settings/vcs', ['repo_name']); + pyroutes.register('edit_repo_vcs_svn_pattern_delete', '/%(repo_name)s/settings/vcs/svn_pattern/delete', ['repo_name']); + pyroutes.register('edit_repo_vcs_update', '/%(repo_name)s/settings/vcs/update', ['repo_name']); + pyroutes.register('edit_user_audit_logs', '/_admin/users/%(user_id)s/edit/audit', ['user_id']); + pyroutes.register('edit_user_audit_logs_download', '/_admin/users/%(user_id)s/edit/audit/download', ['user_id']); + pyroutes.register('edit_user_auth_tokens', '/_admin/users/%(user_id)s/edit/auth_tokens', ['user_id']); + pyroutes.register('edit_user_auth_tokens_add', '/_admin/users/%(user_id)s/edit/auth_tokens/new', ['user_id']); + pyroutes.register('edit_user_auth_tokens_delete', '/_admin/users/%(user_id)s/edit/auth_tokens/delete', ['user_id']); pyroutes.register('edit_user_auth_tokens_view', '/_admin/users/%(user_id)s/edit/auth_tokens/view', ['user_id']); - pyroutes.register('edit_user_auth_tokens_delete', '/_admin/users/%(user_id)s/edit/auth_tokens/delete', ['user_id']); - pyroutes.register('edit_user_ssh_keys', '/_admin/users/%(user_id)s/edit/ssh_keys', ['user_id']); - pyroutes.register('edit_user_ssh_keys_generate_keypair', '/_admin/users/%(user_id)s/edit/ssh_keys/generate', ['user_id']); - pyroutes.register('edit_user_ssh_keys_add', '/_admin/users/%(user_id)s/edit/ssh_keys/new', ['user_id']); - pyroutes.register('edit_user_ssh_keys_delete', '/_admin/users/%(user_id)s/edit/ssh_keys/delete', ['user_id']); + pyroutes.register('edit_user_caches', '/_admin/users/%(user_id)s/edit/caches', ['user_id']); + pyroutes.register('edit_user_caches_update', '/_admin/users/%(user_id)s/edit/caches/update', ['user_id']); pyroutes.register('edit_user_emails', '/_admin/users/%(user_id)s/edit/emails', ['user_id']); pyroutes.register('edit_user_emails_add', '/_admin/users/%(user_id)s/edit/emails/new', ['user_id']); pyroutes.register('edit_user_emails_delete', '/_admin/users/%(user_id)s/edit/emails/delete', ['user_id']); + pyroutes.register('edit_user_group', '/_admin/user_groups/%(user_group_id)s/edit', ['user_group_id']); + pyroutes.register('edit_user_group_advanced', '/_admin/user_groups/%(user_group_id)s/edit/advanced', ['user_group_id']); + pyroutes.register('edit_user_group_advanced_sync', '/_admin/user_groups/%(user_group_id)s/edit/advanced/sync', ['user_group_id']); + pyroutes.register('edit_user_group_global_perms', '/_admin/user_groups/%(user_group_id)s/edit/global_permissions', ['user_group_id']); + pyroutes.register('edit_user_group_global_perms_update', '/_admin/user_groups/%(user_group_id)s/edit/global_permissions/update', ['user_group_id']); + pyroutes.register('edit_user_group_perms', '/_admin/user_groups/%(user_group_id)s/edit/permissions', ['user_group_id']); + pyroutes.register('edit_user_group_perms_summary', '/_admin/user_groups/%(user_group_id)s/edit/permissions_summary', ['user_group_id']); + pyroutes.register('edit_user_group_perms_summary_json', '/_admin/user_groups/%(user_group_id)s/edit/permissions_summary/json', ['user_group_id']); + pyroutes.register('edit_user_group_perms_update', '/_admin/user_groups/%(user_group_id)s/edit/permissions/update', ['user_group_id']); + pyroutes.register('edit_user_groups_management', '/_admin/users/%(user_id)s/edit/groups_management', ['user_id']); + pyroutes.register('edit_user_groups_management_updates', '/_admin/users/%(user_id)s/edit/edit_user_groups_management/updates', ['user_id']); pyroutes.register('edit_user_ips', '/_admin/users/%(user_id)s/edit/ips', ['user_id']); pyroutes.register('edit_user_ips_add', '/_admin/users/%(user_id)s/edit/ips/new', ['user_id']); pyroutes.register('edit_user_ips_delete', '/_admin/users/%(user_id)s/edit/ips/delete', ['user_id']); pyroutes.register('edit_user_perms_summary', '/_admin/users/%(user_id)s/edit/permissions_summary', ['user_id']); pyroutes.register('edit_user_perms_summary_json', '/_admin/users/%(user_id)s/edit/permissions_summary/json', ['user_id']); - pyroutes.register('edit_user_groups_management', '/_admin/users/%(user_id)s/edit/groups_management', ['user_id']); - pyroutes.register('edit_user_groups_management_updates', '/_admin/users/%(user_id)s/edit/edit_user_groups_management/updates', ['user_id']); - pyroutes.register('edit_user_audit_logs', '/_admin/users/%(user_id)s/edit/audit', ['user_id']); - pyroutes.register('edit_user_audit_logs_download', '/_admin/users/%(user_id)s/edit/audit/download', ['user_id']); - pyroutes.register('edit_user_caches', '/_admin/users/%(user_id)s/edit/caches', ['user_id']); - pyroutes.register('edit_user_caches_update', '/_admin/users/%(user_id)s/edit/caches/update', ['user_id']); - pyroutes.register('user_groups', '/_admin/user_groups', []); - pyroutes.register('user_groups_data', '/_admin/user_groups_data', []); - pyroutes.register('user_groups_new', '/_admin/user_groups/new', []); - pyroutes.register('user_groups_create', '/_admin/user_groups/create', []); - pyroutes.register('repos', '/_admin/repos', []); - pyroutes.register('repos_data', '/_admin/repos_data', []); - pyroutes.register('repo_new', '/_admin/repos/new', []); - pyroutes.register('repo_create', '/_admin/repos/create', []); - pyroutes.register('repo_groups', '/_admin/repo_groups', []); - pyroutes.register('repo_groups_data', '/_admin/repo_groups_data', []); - pyroutes.register('repo_group_new', '/_admin/repo_group/new', []); - pyroutes.register('repo_group_create', '/_admin/repo_group/create', []); - pyroutes.register('channelstream_connect', '/_admin/channelstream/connect', []); - pyroutes.register('channelstream_subscribe', '/_admin/channelstream/subscribe', []); - pyroutes.register('channelstream_proxy', '/_channelstream', []); - pyroutes.register('upload_file', '/_file_store/upload', []); - pyroutes.register('download_file', '/_file_store/download/%(fid)s', ['fid']); - pyroutes.register('download_file_by_token', '/_file_store/token-download/%(_auth_token)s/%(fid)s', ['_auth_token', 'fid']); - pyroutes.register('logout', '/_admin/logout', []); - pyroutes.register('reset_password', '/_admin/password_reset', []); - pyroutes.register('reset_password_confirmation', '/_admin/password_reset_confirmation', []); + pyroutes.register('edit_user_ssh_keys', '/_admin/users/%(user_id)s/edit/ssh_keys', ['user_id']); + pyroutes.register('edit_user_ssh_keys_add', '/_admin/users/%(user_id)s/edit/ssh_keys/new', ['user_id']); + pyroutes.register('edit_user_ssh_keys_delete', '/_admin/users/%(user_id)s/edit/ssh_keys/delete', ['user_id']); + pyroutes.register('edit_user_ssh_keys_generate_keypair', '/_admin/users/%(user_id)s/edit/ssh_keys/generate', ['user_id']); + pyroutes.register('favicon', '/favicon.ico', []); + pyroutes.register('file_preview', '/_file_preview', []); + pyroutes.register('gist_delete', '/_admin/gists/%(gist_id)s/delete', ['gist_id']); + pyroutes.register('gist_edit', '/_admin/gists/%(gist_id)s/edit', ['gist_id']); + pyroutes.register('gist_edit_check_revision', '/_admin/gists/%(gist_id)s/edit/check_revision', ['gist_id']); + pyroutes.register('gist_show', '/_admin/gists/%(gist_id)s', ['gist_id']); + pyroutes.register('gist_show_formatted', '/_admin/gists/%(gist_id)s/rev/%(revision)s/%(format)s', ['gist_id', 'revision', 'format']); + pyroutes.register('gist_show_formatted_path', '/_admin/gists/%(gist_id)s/rev/%(revision)s/%(format)s/%(f_path)s', ['gist_id', 'revision', 'format', 'f_path']); + pyroutes.register('gist_show_rev', '/_admin/gists/%(gist_id)s/rev/%(revision)s', ['gist_id', 'revision']); + pyroutes.register('gist_update', '/_admin/gists/%(gist_id)s/update', ['gist_id']); + pyroutes.register('gists_create', '/_admin/gists/create', []); + pyroutes.register('gists_new', '/_admin/gists/new', []); + pyroutes.register('gists_show', '/_admin/gists', []); + pyroutes.register('global_integrations_create', '/_admin/integrations/%(integration)s/new', ['integration']); + pyroutes.register('global_integrations_edit', '/_admin/integrations/%(integration)s/%(integration_id)s', ['integration', 'integration_id']); + pyroutes.register('global_integrations_home', '/_admin/integrations', []); + pyroutes.register('global_integrations_list', '/_admin/integrations/%(integration)s', ['integration']); + pyroutes.register('global_integrations_new', '/_admin/integrations/new', []); + pyroutes.register('goto_switcher_data', '/_goto_data', []); pyroutes.register('home', '/', []); - pyroutes.register('main_page_repos_data', '/_home_repos', []); - pyroutes.register('main_page_repo_groups_data', '/_home_repo_groups', []); - pyroutes.register('user_autocomplete_data', '/_users', []); - pyroutes.register('user_group_autocomplete_data', '/_user_groups', []); - pyroutes.register('repo_list_data', '/_repos', []); - pyroutes.register('repo_group_list_data', '/_repo_groups', []); - pyroutes.register('goto_switcher_data', '/_goto_data', []); - pyroutes.register('markup_preview', '/_markup_preview', []); - pyroutes.register('file_preview', '/_file_preview', []); - pyroutes.register('store_user_session_value', '/_store_session_attr', []); + pyroutes.register('hovercard_pull_request', '/_hovercard/pull_request/%(pull_request_id)s', ['pull_request_id']); + pyroutes.register('hovercard_repo_commit', '/_hovercard/commit/%(repo_name)s/%(commit_id)s', ['repo_name', 'commit_id']); + pyroutes.register('hovercard_user', '/_hovercard/user/%(user_id)s', ['user_id']); + pyroutes.register('hovercard_user_group', '/_hovercard/user_group/%(user_group_id)s', ['user_group_id']); + pyroutes.register('hovercard_username', '/_hovercard/username/%(username)s', ['username']); pyroutes.register('journal', '/_admin/journal', []); - pyroutes.register('journal_rss', '/_admin/journal/rss', []); pyroutes.register('journal_atom', '/_admin/journal/atom', []); pyroutes.register('journal_public', '/_admin/public_journal', []); pyroutes.register('journal_public_atom', '/_admin/public_journal/atom', []); pyroutes.register('journal_public_atom_old', '/_admin/public_journal_atom', []); pyroutes.register('journal_public_rss', '/_admin/public_journal/rss', []); pyroutes.register('journal_public_rss_old', '/_admin/public_journal_rss', []); - pyroutes.register('toggle_following', '/_admin/toggle_following', []); - pyroutes.register('repo_creating', '/%(repo_name)s/repo_creating', ['repo_name']); - pyroutes.register('repo_creating_check', '/%(repo_name)s/repo_creating_check', ['repo_name']); - pyroutes.register('repo_summary_explicit', '/%(repo_name)s/summary', ['repo_name']); - pyroutes.register('repo_summary_commits', '/%(repo_name)s/summary-commits', ['repo_name']); - pyroutes.register('repo_commit', '/%(repo_name)s/changeset/%(commit_id)s', ['repo_name', 'commit_id']); - pyroutes.register('repo_commit_children', '/%(repo_name)s/changeset_children/%(commit_id)s', ['repo_name', 'commit_id']); - pyroutes.register('repo_commit_parents', '/%(repo_name)s/changeset_parents/%(commit_id)s', ['repo_name', 'commit_id']); - pyroutes.register('repo_commit_raw', '/%(repo_name)s/changeset-diff/%(commit_id)s', ['repo_name', 'commit_id']); - pyroutes.register('repo_commit_patch', '/%(repo_name)s/changeset-patch/%(commit_id)s', ['repo_name', 'commit_id']); - pyroutes.register('repo_commit_download', '/%(repo_name)s/changeset-download/%(commit_id)s', ['repo_name', 'commit_id']); - pyroutes.register('repo_commit_data', '/%(repo_name)s/changeset-data/%(commit_id)s', ['repo_name', 'commit_id']); - pyroutes.register('repo_commit_comment_create', '/%(repo_name)s/changeset/%(commit_id)s/comment/create', ['repo_name', 'commit_id']); - pyroutes.register('repo_commit_comment_preview', '/%(repo_name)s/changeset/%(commit_id)s/comment/preview', ['repo_name', 'commit_id']); - pyroutes.register('repo_commit_comment_history_view', '/%(repo_name)s/changeset/%(commit_id)s/comment/%(comment_history_id)s/history_view', ['repo_name', 'commit_id', 'comment_history_id']); - pyroutes.register('repo_commit_comment_attachment_upload', '/%(repo_name)s/changeset/%(commit_id)s/comment/attachment_upload', ['repo_name', 'commit_id']); - pyroutes.register('repo_commit_comment_delete', '/%(repo_name)s/changeset/%(commit_id)s/comment/%(comment_id)s/delete', ['repo_name', 'commit_id', 'comment_id']); - pyroutes.register('repo_commit_comment_edit', '/%(repo_name)s/changeset/%(commit_id)s/comment/%(comment_id)s/edit', ['repo_name', 'commit_id', 'comment_id']); - pyroutes.register('repo_commit_raw_deprecated', '/%(repo_name)s/raw-changeset/%(commit_id)s', ['repo_name', 'commit_id']); - pyroutes.register('repo_archivefile', '/%(repo_name)s/archive/%(fname)s', ['repo_name', 'fname']); - pyroutes.register('repo_files_diff', '/%(repo_name)s/diff/%(f_path)s', ['repo_name', 'f_path']); - pyroutes.register('repo_files_diff_2way_redirect', '/%(repo_name)s/diff-2way/%(f_path)s', ['repo_name', 'f_path']); - pyroutes.register('repo_files', '/%(repo_name)s/files/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_files:default_path', '/%(repo_name)s/files/%(commit_id)s/', ['repo_name', 'commit_id']); - pyroutes.register('repo_files:default_commit', '/%(repo_name)s/files', ['repo_name']); - pyroutes.register('repo_files:rendered', '/%(repo_name)s/render/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_files:annotated', '/%(repo_name)s/annotate/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_files:annotated_previous', '/%(repo_name)s/annotate-previous/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_nodetree_full', '/%(repo_name)s/nodetree_full/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_nodetree_full:default_path', '/%(repo_name)s/nodetree_full/%(commit_id)s/', ['repo_name', 'commit_id']); - pyroutes.register('repo_files_nodelist', '/%(repo_name)s/nodelist/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_file_raw', '/%(repo_name)s/raw/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_file_download', '/%(repo_name)s/download/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_file_download:legacy', '/%(repo_name)s/rawfile/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_file_history', '/%(repo_name)s/history/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_file_authors', '/%(repo_name)s/authors/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_files_check_head', '/%(repo_name)s/check_head/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_files_remove_file', '/%(repo_name)s/remove_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_files_delete_file', '/%(repo_name)s/delete_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_files_edit_file', '/%(repo_name)s/edit_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_files_update_file', '/%(repo_name)s/update_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_files_add_file', '/%(repo_name)s/add_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_files_upload_file', '/%(repo_name)s/upload_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_files_create_file', '/%(repo_name)s/create_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_refs_data', '/%(repo_name)s/refs-data', ['repo_name']); - pyroutes.register('repo_refs_changelog_data', '/%(repo_name)s/refs-data-changelog', ['repo_name']); - pyroutes.register('repo_stats', '/%(repo_name)s/repo_stats/%(commit_id)s', ['repo_name', 'commit_id']); - pyroutes.register('repo_commits', '/%(repo_name)s/commits', ['repo_name']); - pyroutes.register('repo_commits_file', '/%(repo_name)s/commits/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_commits_elements', '/%(repo_name)s/commits_elements', ['repo_name']); - pyroutes.register('repo_commits_elements_file', '/%(repo_name)s/commits_elements/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_changelog', '/%(repo_name)s/changelog', ['repo_name']); - pyroutes.register('repo_changelog_file', '/%(repo_name)s/changelog/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); - pyroutes.register('repo_compare_select', '/%(repo_name)s/compare', ['repo_name']); - pyroutes.register('repo_compare', '/%(repo_name)s/compare/%(source_ref_type)s@%(source_ref)s...%(target_ref_type)s@%(target_ref)s', ['repo_name', 'source_ref_type', 'source_ref', 'target_ref_type', 'target_ref']); - pyroutes.register('tags_home', '/%(repo_name)s/tags', ['repo_name']); - pyroutes.register('branches_home', '/%(repo_name)s/branches', ['repo_name']); - pyroutes.register('bookmarks_home', '/%(repo_name)s/bookmarks', ['repo_name']); - pyroutes.register('repo_fork_new', '/%(repo_name)s/fork', ['repo_name']); - pyroutes.register('repo_fork_create', '/%(repo_name)s/fork/create', ['repo_name']); - pyroutes.register('repo_forks_show_all', '/%(repo_name)s/forks', ['repo_name']); - pyroutes.register('repo_forks_data', '/%(repo_name)s/forks/data', ['repo_name']); + pyroutes.register('journal_rss', '/_admin/journal/rss', []); + pyroutes.register('login', '/_admin/login', []); + pyroutes.register('logout', '/_admin/logout', []); + pyroutes.register('main_page_repo_groups_data', '/_home_repo_groups', []); + pyroutes.register('main_page_repos_data', '/_home_repos', []); + pyroutes.register('markup_preview', '/_markup_preview', []); + pyroutes.register('my_account_auth_tokens', '/_admin/my_account/auth_tokens', []); + pyroutes.register('my_account_auth_tokens_add', '/_admin/my_account/auth_tokens/new', []); + pyroutes.register('my_account_auth_tokens_delete', '/_admin/my_account/auth_tokens/delete', []); + pyroutes.register('my_account_auth_tokens_view', '/_admin/my_account/auth_tokens/view', []); + pyroutes.register('my_account_bookmarks', '/_admin/my_account/bookmarks', []); + pyroutes.register('my_account_bookmarks_update', '/_admin/my_account/bookmarks/update', []); + pyroutes.register('my_account_edit', '/_admin/my_account/edit', []); + pyroutes.register('my_account_emails', '/_admin/my_account/emails', []); + pyroutes.register('my_account_emails_add', '/_admin/my_account/emails/new', []); + pyroutes.register('my_account_emails_delete', '/_admin/my_account/emails/delete', []); + pyroutes.register('my_account_external_identity', '/_admin/my_account/external-identity', []); + pyroutes.register('my_account_external_identity_delete', '/_admin/my_account/external-identity/delete', []); + pyroutes.register('my_account_goto_bookmark', '/_admin/my_account/bookmark/%(bookmark_id)s', ['bookmark_id']); + pyroutes.register('my_account_notifications', '/_admin/my_account/notifications', []); + pyroutes.register('my_account_notifications_test_channelstream', '/_admin/my_account/test_channelstream', []); + pyroutes.register('my_account_notifications_toggle_visibility', '/_admin/my_account/toggle_visibility', []); + pyroutes.register('my_account_password', '/_admin/my_account/password', []); + pyroutes.register('my_account_password_update', '/_admin/my_account/password/update', []); + pyroutes.register('my_account_perms', '/_admin/my_account/perms', []); + pyroutes.register('my_account_profile', '/_admin/my_account/profile', []); + pyroutes.register('my_account_pullrequests', '/_admin/my_account/pull_requests', []); + pyroutes.register('my_account_pullrequests_data', '/_admin/my_account/pull_requests/data', []); + pyroutes.register('my_account_repos', '/_admin/my_account/repos', []); + pyroutes.register('my_account_ssh_keys', '/_admin/my_account/ssh_keys', []); + pyroutes.register('my_account_ssh_keys_add', '/_admin/my_account/ssh_keys/new', []); + pyroutes.register('my_account_ssh_keys_delete', '/_admin/my_account/ssh_keys/delete', []); + pyroutes.register('my_account_ssh_keys_generate', '/_admin/my_account/ssh_keys/generate', []); + pyroutes.register('my_account_update', '/_admin/my_account/update', []); + pyroutes.register('my_account_user_group_membership', '/_admin/my_account/user_group_membership', []); + pyroutes.register('my_account_watched', '/_admin/my_account/watched', []); + pyroutes.register('notifications_delete', '/_admin/notifications/%(notification_id)s/delete', ['notification_id']); + pyroutes.register('notifications_mark_all_read', '/_admin/notifications_mark_all_read', []); + pyroutes.register('notifications_show', '/_admin/notifications/%(notification_id)s', ['notification_id']); + pyroutes.register('notifications_show_all', '/_admin/notifications', []); + pyroutes.register('notifications_update', '/_admin/notifications/%(notification_id)s/update', ['notification_id']); + pyroutes.register('ops_error_test', '/_admin/ops/error', []); + pyroutes.register('ops_ping', '/_admin/ops/ping', []); + pyroutes.register('ops_redirect_test', '/_admin/ops/redirect', []); + pyroutes.register('plugin_admin_chat', '/_admin/plugin_admin_chat/%(action)s', ['action']); + pyroutes.register('pull_requests_global', '/_admin/pull-request/%(pull_request_id)s', ['pull_request_id']); + pyroutes.register('pull_requests_global_0', '/_admin/pull_requests/%(pull_request_id)s', ['pull_request_id']); + pyroutes.register('pull_requests_global_1', '/_admin/pull-requests/%(pull_request_id)s', ['pull_request_id']); + pyroutes.register('pullrequest_comment_create', '/%(repo_name)s/pull-request/%(pull_request_id)s/comment', ['repo_name', 'pull_request_id']); + pyroutes.register('pullrequest_comment_delete', '/%(repo_name)s/pull-request/%(pull_request_id)s/comment/%(comment_id)s/delete', ['repo_name', 'pull_request_id', 'comment_id']); + pyroutes.register('pullrequest_comment_edit', '/%(repo_name)s/pull-request/%(pull_request_id)s/comment/%(comment_id)s/edit', ['repo_name', 'pull_request_id', 'comment_id']); + pyroutes.register('pullrequest_comments', '/%(repo_name)s/pull-request/%(pull_request_id)s/comments', ['repo_name', 'pull_request_id']); + pyroutes.register('pullrequest_create', '/%(repo_name)s/pull-request/create', ['repo_name']); + pyroutes.register('pullrequest_delete', '/%(repo_name)s/pull-request/%(pull_request_id)s/delete', ['repo_name', 'pull_request_id']); + pyroutes.register('pullrequest_draft_comments_submit', '/%(repo_name)s/pull-request/%(pull_request_id)s/draft_comments_submit', ['repo_name', 'pull_request_id']); + pyroutes.register('pullrequest_drafts', '/%(repo_name)s/pull-request/%(pull_request_id)s/drafts', ['repo_name', 'pull_request_id']); + pyroutes.register('pullrequest_merge', '/%(repo_name)s/pull-request/%(pull_request_id)s/merge', ['repo_name', 'pull_request_id']); + pyroutes.register('pullrequest_new', '/%(repo_name)s/pull-request/new', ['repo_name']); + pyroutes.register('pullrequest_repo_refs', '/%(repo_name)s/pull-request/refs/%(target_repo_name)s', ['repo_name', 'target_repo_name']); + pyroutes.register('pullrequest_repo_targets', '/%(repo_name)s/pull-request/repo-targets', ['repo_name']); pyroutes.register('pullrequest_show', '/%(repo_name)s/pull-request/%(pull_request_id)s', ['repo_name', 'pull_request_id']); pyroutes.register('pullrequest_show_all', '/%(repo_name)s/pull-request', ['repo_name']); pyroutes.register('pullrequest_show_all_data', '/%(repo_name)s/pull-request-data', ['repo_name']); - pyroutes.register('pullrequest_repo_refs', '/%(repo_name)s/pull-request/refs/%(target_repo_name)s', ['repo_name', 'target_repo_name']); - pyroutes.register('pullrequest_repo_targets', '/%(repo_name)s/pull-request/repo-targets', ['repo_name']); - pyroutes.register('pullrequest_new', '/%(repo_name)s/pull-request/new', ['repo_name']); - pyroutes.register('pullrequest_create', '/%(repo_name)s/pull-request/create', ['repo_name']); + pyroutes.register('pullrequest_todos', '/%(repo_name)s/pull-request/%(pull_request_id)s/todos', ['repo_name', 'pull_request_id']); pyroutes.register('pullrequest_update', '/%(repo_name)s/pull-request/%(pull_request_id)s/update', ['repo_name', 'pull_request_id']); - pyroutes.register('pullrequest_merge', '/%(repo_name)s/pull-request/%(pull_request_id)s/merge', ['repo_name', 'pull_request_id']); - pyroutes.register('pullrequest_delete', '/%(repo_name)s/pull-request/%(pull_request_id)s/delete', ['repo_name', 'pull_request_id']); - pyroutes.register('pullrequest_comment_create', '/%(repo_name)s/pull-request/%(pull_request_id)s/comment', ['repo_name', 'pull_request_id']); - pyroutes.register('pullrequest_comment_edit', '/%(repo_name)s/pull-request/%(pull_request_id)s/comment/%(comment_id)s/edit', ['repo_name', 'pull_request_id', 'comment_id']); - pyroutes.register('pullrequest_comment_delete', '/%(repo_name)s/pull-request/%(pull_request_id)s/comment/%(comment_id)s/delete', ['repo_name', 'pull_request_id', 'comment_id']); - pyroutes.register('pullrequest_comments', '/%(repo_name)s/pull-request/%(pull_request_id)s/comments', ['repo_name', 'pull_request_id']); - pyroutes.register('pullrequest_todos', '/%(repo_name)s/pull-request/%(pull_request_id)s/todos', ['repo_name', 'pull_request_id']); - pyroutes.register('pullrequest_drafts', '/%(repo_name)s/pull-request/%(pull_request_id)s/drafts', ['repo_name', 'pull_request_id']); - pyroutes.register('edit_repo', '/%(repo_name)s/settings', ['repo_name']); - pyroutes.register('edit_repo_advanced', '/%(repo_name)s/settings/advanced', ['repo_name']); - pyroutes.register('edit_repo_advanced_archive', '/%(repo_name)s/settings/advanced/archive', ['repo_name']); - pyroutes.register('edit_repo_advanced_delete', '/%(repo_name)s/settings/advanced/delete', ['repo_name']); - pyroutes.register('edit_repo_advanced_locking', '/%(repo_name)s/settings/advanced/locking', ['repo_name']); - pyroutes.register('edit_repo_advanced_journal', '/%(repo_name)s/settings/advanced/journal', ['repo_name']); - pyroutes.register('edit_repo_advanced_fork', '/%(repo_name)s/settings/advanced/fork', ['repo_name']); - pyroutes.register('edit_repo_advanced_hooks', '/%(repo_name)s/settings/advanced/hooks', ['repo_name']); - pyroutes.register('edit_repo_caches', '/%(repo_name)s/settings/caches', ['repo_name']); - pyroutes.register('edit_repo_perms', '/%(repo_name)s/settings/permissions', ['repo_name']); - pyroutes.register('edit_repo_perms_set_private', '/%(repo_name)s/settings/permissions/set_private', ['repo_name']); - pyroutes.register('edit_repo_maintenance', '/%(repo_name)s/settings/maintenance', ['repo_name']); - pyroutes.register('edit_repo_maintenance_execute', '/%(repo_name)s/settings/maintenance/execute', ['repo_name']); - pyroutes.register('edit_repo_fields', '/%(repo_name)s/settings/fields', ['repo_name']); - pyroutes.register('edit_repo_fields_create', '/%(repo_name)s/settings/fields/create', ['repo_name']); - pyroutes.register('edit_repo_fields_delete', '/%(repo_name)s/settings/fields/%(field_id)s/delete', ['repo_name', 'field_id']); + pyroutes.register('register', '/_admin/register', []); + pyroutes.register('repo_archivefile', '/%(repo_name)s/archive/%(fname)s', ['repo_name', 'fname']); + pyroutes.register('repo_artifacts_data', '/%(repo_name)s/artifacts_data', ['repo_name']); + pyroutes.register('repo_artifacts_delete', '/%(repo_name)s/artifacts/delete/%(uid)s', ['repo_name', 'uid']); + pyroutes.register('repo_artifacts_get', '/%(repo_name)s/artifacts/download/%(uid)s', ['repo_name', 'uid']); + pyroutes.register('repo_artifacts_info', '/%(repo_name)s/artifacts/info/%(uid)s', ['repo_name', 'uid']); + pyroutes.register('repo_artifacts_list', '/%(repo_name)s/artifacts', ['repo_name']); + pyroutes.register('repo_artifacts_new', '/%(repo_name)s/artifacts/new', ['repo_name']); + pyroutes.register('repo_artifacts_store', '/%(repo_name)s/artifacts/store', ['repo_name']); + pyroutes.register('repo_artifacts_update', '/%(repo_name)s/artifacts/update/%(uid)s', ['repo_name', 'uid']); + pyroutes.register('repo_automation', '/%(repo_name)s/settings/automation', ['repo_name']); + pyroutes.register('repo_automation_update', '/%(repo_name)s/settings/automation/%(entry_id)s/update', ['repo_name', 'entry_id']); + pyroutes.register('repo_changelog', '/%(repo_name)s/changelog', ['repo_name']); + pyroutes.register('repo_changelog_file', '/%(repo_name)s/changelog/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_commit', '/%(repo_name)s/changeset/%(commit_id)s', ['repo_name', 'commit_id']); + pyroutes.register('repo_commit_children', '/%(repo_name)s/changeset_children/%(commit_id)s', ['repo_name', 'commit_id']); + pyroutes.register('repo_commit_comment_attachment_upload', '/%(repo_name)s/changeset/%(commit_id)s/comment/attachment_upload', ['repo_name', 'commit_id']); + pyroutes.register('repo_commit_comment_create', '/%(repo_name)s/changeset/%(commit_id)s/comment/create', ['repo_name', 'commit_id']); + pyroutes.register('repo_commit_comment_delete', '/%(repo_name)s/changeset/%(commit_id)s/comment/%(comment_id)s/delete', ['repo_name', 'commit_id', 'comment_id']); + pyroutes.register('repo_commit_comment_edit', '/%(repo_name)s/changeset/%(commit_id)s/comment/%(comment_id)s/edit', ['repo_name', 'commit_id', 'comment_id']); + pyroutes.register('repo_commit_comment_history_view', '/%(repo_name)s/changeset/%(commit_id)s/comment/%(comment_history_id)s/history_view', ['repo_name', 'commit_id', 'comment_history_id']); + pyroutes.register('repo_commit_comment_preview', '/%(repo_name)s/changeset/%(commit_id)s/comment/preview', ['repo_name', 'commit_id']); + pyroutes.register('repo_commit_data', '/%(repo_name)s/changeset-data/%(commit_id)s', ['repo_name', 'commit_id']); + pyroutes.register('repo_commit_download', '/%(repo_name)s/changeset-download/%(commit_id)s', ['repo_name', 'commit_id']); + pyroutes.register('repo_commit_parents', '/%(repo_name)s/changeset_parents/%(commit_id)s', ['repo_name', 'commit_id']); + pyroutes.register('repo_commit_patch', '/%(repo_name)s/changeset-patch/%(commit_id)s', ['repo_name', 'commit_id']); + pyroutes.register('repo_commit_raw', '/%(repo_name)s/changeset-diff/%(commit_id)s', ['repo_name', 'commit_id']); + pyroutes.register('repo_commit_raw_deprecated', '/%(repo_name)s/raw-changeset/%(commit_id)s', ['repo_name', 'commit_id']); + pyroutes.register('repo_commits', '/%(repo_name)s/commits', ['repo_name']); + pyroutes.register('repo_commits_elements', '/%(repo_name)s/commits_elements', ['repo_name']); + pyroutes.register('repo_commits_elements_file', '/%(repo_name)s/commits_elements/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_commits_file', '/%(repo_name)s/commits/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_compare', '/%(repo_name)s/compare/%(source_ref_type)s@%(source_ref)s...%(target_ref_type)s@%(target_ref)s', ['repo_name', 'source_ref_type', 'source_ref', 'target_ref_type', 'target_ref']); + pyroutes.register('repo_compare_select', '/%(repo_name)s/compare', ['repo_name']); + pyroutes.register('repo_create', '/_admin/repos/create', []); + pyroutes.register('repo_creating', '/%(repo_name)s/repo_creating', ['repo_name']); + pyroutes.register('repo_creating_check', '/%(repo_name)s/repo_creating_check', ['repo_name']); + pyroutes.register('repo_default_reviewers_data', '/%(repo_name)s/settings/review/default-reviewers', ['repo_name']); pyroutes.register('repo_edit_toggle_locking', '/%(repo_name)s/settings/toggle_locking', ['repo_name']); - pyroutes.register('edit_repo_remote', '/%(repo_name)s/settings/remote', ['repo_name']); - pyroutes.register('edit_repo_remote_pull', '/%(repo_name)s/settings/remote/pull', ['repo_name']); - pyroutes.register('edit_repo_statistics', '/%(repo_name)s/settings/statistics', ['repo_name']); - pyroutes.register('edit_repo_statistics_reset', '/%(repo_name)s/settings/statistics/update', ['repo_name']); - pyroutes.register('edit_repo_issuetracker', '/%(repo_name)s/settings/issue_trackers', ['repo_name']); - pyroutes.register('edit_repo_issuetracker_test', '/%(repo_name)s/settings/issue_trackers/test', ['repo_name']); - pyroutes.register('edit_repo_issuetracker_delete', '/%(repo_name)s/settings/issue_trackers/delete', ['repo_name']); - pyroutes.register('edit_repo_issuetracker_update', '/%(repo_name)s/settings/issue_trackers/update', ['repo_name']); - pyroutes.register('edit_repo_vcs', '/%(repo_name)s/settings/vcs', ['repo_name']); - pyroutes.register('edit_repo_vcs_update', '/%(repo_name)s/settings/vcs/update', ['repo_name']); - pyroutes.register('edit_repo_vcs_svn_pattern_delete', '/%(repo_name)s/settings/vcs/svn_pattern/delete', ['repo_name']); - pyroutes.register('repo_reviewers', '/%(repo_name)s/settings/review/rules', ['repo_name']); - pyroutes.register('repo_default_reviewers_data', '/%(repo_name)s/settings/review/default-reviewers', ['repo_name']); - pyroutes.register('edit_repo_strip', '/%(repo_name)s/settings/strip', ['repo_name']); - pyroutes.register('strip_check', '/%(repo_name)s/settings/strip_check', ['repo_name']); - pyroutes.register('strip_execute', '/%(repo_name)s/settings/strip_execute', ['repo_name']); - pyroutes.register('edit_repo_audit_logs', '/%(repo_name)s/settings/audit_logs', ['repo_name']); - pyroutes.register('rss_feed_home', '/%(repo_name)s/feed-rss', ['repo_name']); - pyroutes.register('atom_feed_home', '/%(repo_name)s/feed-atom', ['repo_name']); - pyroutes.register('rss_feed_home_old', '/%(repo_name)s/feed/rss', ['repo_name']); - pyroutes.register('atom_feed_home_old', '/%(repo_name)s/feed/atom', ['repo_name']); - pyroutes.register('repo_summary', '/%(repo_name)s', ['repo_name']); - pyroutes.register('repo_summary_slash', '/%(repo_name)s/', ['repo_name']); - pyroutes.register('edit_repo_group', '/%(repo_group_name)s/_edit', ['repo_group_name']); - pyroutes.register('edit_repo_group_advanced', '/%(repo_group_name)s/_settings/advanced', ['repo_group_name']); - pyroutes.register('edit_repo_group_advanced_delete', '/%(repo_group_name)s/_settings/advanced/delete', ['repo_group_name']); - pyroutes.register('edit_repo_group_perms', '/%(repo_group_name)s/_settings/permissions', ['repo_group_name']); - pyroutes.register('edit_repo_group_perms_update', '/%(repo_group_name)s/_settings/permissions/update', ['repo_group_name']); + pyroutes.register('repo_file_authors', '/%(repo_name)s/authors/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_file_download', '/%(repo_name)s/download/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_file_download:legacy', '/%(repo_name)s/rawfile/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_file_history', '/%(repo_name)s/history/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_file_raw', '/%(repo_name)s/raw/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_files', '/%(repo_name)s/files/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_files:annotated', '/%(repo_name)s/annotate/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_files:annotated_previous', '/%(repo_name)s/annotate-previous/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_files:default_commit', '/%(repo_name)s/files', ['repo_name']); + pyroutes.register('repo_files:default_path', '/%(repo_name)s/files/%(commit_id)s/', ['repo_name', 'commit_id']); + pyroutes.register('repo_files:rendered', '/%(repo_name)s/render/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_files_add_file', '/%(repo_name)s/add_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_files_check_head', '/%(repo_name)s/check_head/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_files_create_file', '/%(repo_name)s/create_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_files_delete_file', '/%(repo_name)s/delete_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_files_diff', '/%(repo_name)s/diff/%(f_path)s', ['repo_name', 'f_path']); + pyroutes.register('repo_files_diff_2way_redirect', '/%(repo_name)s/diff-2way/%(f_path)s', ['repo_name', 'f_path']); + pyroutes.register('repo_files_edit_file', '/%(repo_name)s/edit_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_files_nodelist', '/%(repo_name)s/nodelist/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_files_remove_file', '/%(repo_name)s/remove_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_files_update_file', '/%(repo_name)s/update_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_files_upload_file', '/%(repo_name)s/upload_file/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_fork_create', '/%(repo_name)s/fork/create', ['repo_name']); + pyroutes.register('repo_fork_new', '/%(repo_name)s/fork', ['repo_name']); + pyroutes.register('repo_forks_data', '/%(repo_name)s/forks/data', ['repo_name']); + pyroutes.register('repo_forks_show_all', '/%(repo_name)s/forks', ['repo_name']); + pyroutes.register('repo_group_create', '/_admin/repo_group/create', []); pyroutes.register('repo_group_home', '/%(repo_group_name)s', ['repo_group_name']); pyroutes.register('repo_group_home_slash', '/%(repo_group_name)s/', ['repo_group_name']); - pyroutes.register('user_group_members_data', '/_admin/user_groups/%(user_group_id)s/members', ['user_group_id']); - pyroutes.register('edit_user_group_perms_summary', '/_admin/user_groups/%(user_group_id)s/edit/permissions_summary', ['user_group_id']); - pyroutes.register('edit_user_group_perms_summary_json', '/_admin/user_groups/%(user_group_id)s/edit/permissions_summary/json', ['user_group_id']); - pyroutes.register('edit_user_group', '/_admin/user_groups/%(user_group_id)s/edit', ['user_group_id']); - pyroutes.register('user_groups_update', '/_admin/user_groups/%(user_group_id)s/update', ['user_group_id']); - pyroutes.register('edit_user_group_global_perms', '/_admin/user_groups/%(user_group_id)s/edit/global_permissions', ['user_group_id']); - pyroutes.register('edit_user_group_global_perms_update', '/_admin/user_groups/%(user_group_id)s/edit/global_permissions/update', ['user_group_id']); - pyroutes.register('edit_user_group_perms', '/_admin/user_groups/%(user_group_id)s/edit/permissions', ['user_group_id']); - pyroutes.register('edit_user_group_perms_update', '/_admin/user_groups/%(user_group_id)s/edit/permissions/update', ['user_group_id']); - pyroutes.register('edit_user_group_advanced', '/_admin/user_groups/%(user_group_id)s/edit/advanced', ['user_group_id']); - pyroutes.register('edit_user_group_advanced_sync', '/_admin/user_groups/%(user_group_id)s/edit/advanced/sync', ['user_group_id']); - pyroutes.register('user_groups_delete', '/_admin/user_groups/%(user_group_id)s/delete', ['user_group_id']); + pyroutes.register('repo_group_integrations_create', '/%(repo_group_name)s/_settings/integrations/%(integration)s/new', ['repo_group_name', 'integration']); + pyroutes.register('repo_group_integrations_edit', '/%(repo_group_name)s/_settings/integrations/%(integration)s/%(integration_id)s', ['repo_group_name', 'integration', 'integration_id']); + pyroutes.register('repo_group_integrations_home', '/%(repo_group_name)s/_settings/integrations', ['repo_group_name']); + pyroutes.register('repo_group_integrations_list', '/%(repo_group_name)s/_settings/integrations/%(integration)s', ['repo_group_name', 'integration']); + pyroutes.register('repo_group_integrations_new', '/%(repo_group_name)s/_settings/integrations/new', ['repo_group_name']); + pyroutes.register('repo_group_list_data', '/_repo_groups', []); + pyroutes.register('repo_group_new', '/_admin/repo_group/new', []); + pyroutes.register('repo_groups', '/_admin/repo_groups', []); + pyroutes.register('repo_groups_data', '/_admin/repo_groups_data', []); + pyroutes.register('repo_integrations_create', '/%(repo_name)s/settings/integrations/%(integration)s/new', ['repo_name', 'integration']); + pyroutes.register('repo_integrations_edit', '/%(repo_name)s/settings/integrations/%(integration)s/%(integration_id)s', ['repo_name', 'integration', 'integration_id']); + pyroutes.register('repo_integrations_home', '/%(repo_name)s/settings/integrations', ['repo_name']); + pyroutes.register('repo_integrations_list', '/%(repo_name)s/settings/integrations/%(integration)s', ['repo_name', 'integration']); + pyroutes.register('repo_integrations_new', '/%(repo_name)s/settings/integrations/new', ['repo_name']); + pyroutes.register('repo_list_data', '/_repos', []); + pyroutes.register('repo_new', '/_admin/repos/new', []); + pyroutes.register('repo_nodetree_full', '/%(repo_name)s/nodetree_full/%(commit_id)s/%(f_path)s', ['repo_name', 'commit_id', 'f_path']); + pyroutes.register('repo_nodetree_full:default_path', '/%(repo_name)s/nodetree_full/%(commit_id)s/', ['repo_name', 'commit_id']); + pyroutes.register('repo_refs_changelog_data', '/%(repo_name)s/refs-data-changelog', ['repo_name']); + pyroutes.register('repo_refs_data', '/%(repo_name)s/refs-data', ['repo_name']); + pyroutes.register('repo_reviewers', '/%(repo_name)s/settings/review/rules', ['repo_name']); + pyroutes.register('repo_reviewers_review_rule_delete', '/%(repo_name)s/settings/review/rules/%(rule_id)s/delete', ['repo_name', 'rule_id']); + pyroutes.register('repo_reviewers_review_rule_edit', '/%(repo_name)s/settings/review/rules/%(rule_id)s', ['repo_name', 'rule_id']); + pyroutes.register('repo_reviewers_review_rule_new', '/%(repo_name)s/settings/review/rules/new', ['repo_name']); + pyroutes.register('repo_stats', '/%(repo_name)s/repo_stats/%(commit_id)s', ['repo_name', 'commit_id']); + pyroutes.register('repo_summary', '/%(repo_name)s', ['repo_name']); + pyroutes.register('repo_summary_commits', '/%(repo_name)s/summary-commits', ['repo_name']); + pyroutes.register('repo_summary_explicit', '/%(repo_name)s/summary', ['repo_name']); + pyroutes.register('repo_summary_slash', '/%(repo_name)s/', ['repo_name']); + pyroutes.register('repos', '/_admin/repos', []); + pyroutes.register('repos_data', '/_admin/repos_data', []); + pyroutes.register('reset_password', '/_admin/password_reset', []); + pyroutes.register('reset_password_confirmation', '/_admin/password_reset_confirmation', []); + pyroutes.register('robots', '/robots.txt', []); + pyroutes.register('rss_feed_home', '/%(repo_name)s/feed-rss', ['repo_name']); + pyroutes.register('rss_feed_home_old', '/%(repo_name)s/feed/rss', ['repo_name']); pyroutes.register('search', '/_admin/search', []); pyroutes.register('search_repo', '/%(repo_name)s/_search', ['repo_name']); pyroutes.register('search_repo_alt', '/%(repo_name)s/search', ['repo_name']); pyroutes.register('search_repo_group', '/%(repo_group_name)s/_search', ['repo_group_name']); - pyroutes.register('user_profile', '/_profiles/%(username)s', ['username']); + pyroutes.register('store_user_session_value', '/_store_session_attr', []); + pyroutes.register('strip_check', '/%(repo_name)s/settings/strip_check', ['repo_name']); + pyroutes.register('strip_execute', '/%(repo_name)s/settings/strip_execute', ['repo_name']); + pyroutes.register('tags_home', '/%(repo_name)s/tags', ['repo_name']); + pyroutes.register('toggle_following', '/_admin/toggle_following', []); + pyroutes.register('upload_file', '/_file_store/upload', []); + pyroutes.register('user_autocomplete_data', '/_users', []); + pyroutes.register('user_create_personal_repo_group', '/_admin/users/%(user_id)s/create_repo_group', ['user_id']); + pyroutes.register('user_delete', '/_admin/users/%(user_id)s/delete', ['user_id']); + pyroutes.register('user_disable_force_password_reset', '/_admin/users/%(user_id)s/password_reset_disable', ['user_id']); + pyroutes.register('user_edit', '/_admin/users/%(user_id)s/edit', ['user_id']); + pyroutes.register('user_edit_advanced', '/_admin/users/%(user_id)s/edit/advanced', ['user_id']); + pyroutes.register('user_edit_global_perms', '/_admin/users/%(user_id)s/edit/global_permissions', ['user_id']); + pyroutes.register('user_edit_global_perms_update', '/_admin/users/%(user_id)s/edit/global_permissions/update', ['user_id']); + pyroutes.register('user_enable_force_password_reset', '/_admin/users/%(user_id)s/password_reset_enable', ['user_id']); + pyroutes.register('user_group_autocomplete_data', '/_user_groups', []); + pyroutes.register('user_group_members_data', '/_admin/user_groups/%(user_group_id)s/members', ['user_group_id']); pyroutes.register('user_group_profile', '/_profile_user_group/%(user_group_name)s', ['user_group_name']); - pyroutes.register('my_account_profile', '/_admin/my_account/profile', []); - pyroutes.register('my_account_edit', '/_admin/my_account/edit', []); - pyroutes.register('my_account_update', '/_admin/my_account/update', []); - pyroutes.register('my_account_password', '/_admin/my_account/password', []); - pyroutes.register('my_account_password_update', '/_admin/my_account/password/update', []); - pyroutes.register('my_account_auth_tokens_view', '/_admin/my_account/auth_tokens/view', []); - pyroutes.register('my_account_auth_tokens_delete', '/_admin/my_account/auth_tokens/delete', []); - pyroutes.register('my_account_ssh_keys', '/_admin/my_account/ssh_keys', []); - pyroutes.register('my_account_ssh_keys_generate', '/_admin/my_account/ssh_keys/generate', []); - pyroutes.register('my_account_ssh_keys_add', '/_admin/my_account/ssh_keys/new', []); - pyroutes.register('my_account_ssh_keys_delete', '/_admin/my_account/ssh_keys/delete', []); - pyroutes.register('my_account_user_group_membership', '/_admin/my_account/user_group_membership', []); - pyroutes.register('my_account_emails', '/_admin/my_account/emails', []); - pyroutes.register('my_account_emails_add', '/_admin/my_account/emails/new', []); - pyroutes.register('my_account_emails_delete', '/_admin/my_account/emails/delete', []); - pyroutes.register('my_account_repos', '/_admin/my_account/repos', []); - pyroutes.register('my_account_watched', '/_admin/my_account/watched', []); - pyroutes.register('my_account_bookmarks', '/_admin/my_account/bookmarks', []); - pyroutes.register('my_account_bookmarks_update', '/_admin/my_account/bookmarks/update', []); - pyroutes.register('my_account_goto_bookmark', '/_admin/my_account/bookmark/%(bookmark_id)s', ['bookmark_id']); - pyroutes.register('my_account_perms', '/_admin/my_account/perms', []); - pyroutes.register('my_account_notifications', '/_admin/my_account/notifications', []); - pyroutes.register('my_account_notifications_toggle_visibility', '/_admin/my_account/toggle_visibility', []); - pyroutes.register('my_account_pullrequests', '/_admin/my_account/pull_requests', []); - pyroutes.register('my_account_pullrequests_data', '/_admin/my_account/pull_requests/data', []); - pyroutes.register('notifications_show_all', '/_admin/notifications', []); - pyroutes.register('notifications_mark_all_read', '/_admin/notifications/mark_all_read', []); - pyroutes.register('notifications_show', '/_admin/notifications/%(notification_id)s', ['notification_id']); - pyroutes.register('notifications_update', '/_admin/notifications/%(notification_id)s/update', ['notification_id']); - pyroutes.register('notifications_delete', '/_admin/notifications/%(notification_id)s/delete', ['notification_id']); - pyroutes.register('my_account_notifications_test_channelstream', '/_admin/my_account/test_channelstream', []); - pyroutes.register('gists_show', '/_admin/gists', []); - pyroutes.register('gists_new', '/_admin/gists/new', []); - pyroutes.register('gists_create', '/_admin/gists/create', []); - pyroutes.register('gist_show', '/_admin/gists/%(gist_id)s', ['gist_id']); - pyroutes.register('gist_delete', '/_admin/gists/%(gist_id)s/delete', ['gist_id']); - pyroutes.register('gist_edit', '/_admin/gists/%(gist_id)s/edit', ['gist_id']); - pyroutes.register('gist_edit_check_revision', '/_admin/gists/%(gist_id)s/edit/check_revision', ['gist_id']); - pyroutes.register('gist_update', '/_admin/gists/%(gist_id)s/update', ['gist_id']); - pyroutes.register('gist_show_rev', '/_admin/gists/%(gist_id)s/%(revision)s', ['gist_id', 'revision']); - pyroutes.register('gist_show_formatted', '/_admin/gists/%(gist_id)s/%(revision)s/%(format)s', ['gist_id', 'revision', 'format']); - pyroutes.register('gist_show_formatted_path', '/_admin/gists/%(gist_id)s/%(revision)s/%(format)s/%(f_path)s', ['gist_id', 'revision', 'format', 'f_path']); - pyroutes.register('debug_style_home', '/_admin/debug_style', []); - pyroutes.register('debug_style_email', '/_admin/debug_style/email/%(email_id)s', ['email_id']); - pyroutes.register('debug_style_email_plain_rendered', '/_admin/debug_style/email-rendered/%(email_id)s', ['email_id']); - pyroutes.register('debug_style_template', '/_admin/debug_style/t/%(t_path)s', ['t_path']); - pyroutes.register('apiv2', '/_admin/api', []); - pyroutes.register('admin_settings_license', '/_admin/settings/license', []); - pyroutes.register('admin_settings_license_unlock', '/_admin/settings/license_unlock', []); - pyroutes.register('login', '/_admin/login', []); - pyroutes.register('register', '/_admin/register', []); - pyroutes.register('repo_reviewers_review_rule_new', '/%(repo_name)s/settings/review/rules/new', ['repo_name']); - pyroutes.register('repo_reviewers_review_rule_edit', '/%(repo_name)s/settings/review/rules/%(rule_id)s', ['repo_name', 'rule_id']); - pyroutes.register('repo_reviewers_review_rule_delete', '/%(repo_name)s/settings/review/rules/%(rule_id)s/delete', ['repo_name', 'rule_id']); - pyroutes.register('plugin_admin_chat', '/_admin/plugin_admin_chat/%(action)s', ['action']); - pyroutes.register('edit_user_auth_tokens', '/_admin/users/%(user_id)s/edit/auth_tokens', ['user_id']); - pyroutes.register('edit_user_auth_tokens_add', '/_admin/users/%(user_id)s/edit/auth_tokens/new', ['user_id']); - pyroutes.register('admin_settings_scheduler_show_tasks', '/_admin/settings/scheduler/_tasks', []); - pyroutes.register('admin_settings_scheduler_show_all', '/_admin/settings/scheduler', []); - pyroutes.register('admin_settings_scheduler_new', '/_admin/settings/scheduler/new', []); - pyroutes.register('admin_settings_scheduler_create', '/_admin/settings/scheduler/create', []); - pyroutes.register('admin_settings_scheduler_edit', '/_admin/settings/scheduler/%(schedule_id)s', ['schedule_id']); - pyroutes.register('admin_settings_scheduler_update', '/_admin/settings/scheduler/%(schedule_id)s/update', ['schedule_id']); - pyroutes.register('admin_settings_scheduler_delete', '/_admin/settings/scheduler/%(schedule_id)s/delete', ['schedule_id']); - pyroutes.register('admin_settings_scheduler_execute', '/_admin/settings/scheduler/%(schedule_id)s/execute', ['schedule_id']); - pyroutes.register('admin_settings_automation', '/_admin/settings/automation', []); - pyroutes.register('admin_settings_automation_update', '/_admin/settings/automation/%(entry_id)s/update', ['entry_id']); - pyroutes.register('admin_permissions_branch', '/_admin/permissions/branch', []); - pyroutes.register('admin_permissions_branch_update', '/_admin/permissions/branch/update', []); - pyroutes.register('my_account_auth_tokens', '/_admin/my_account/auth_tokens', []); - pyroutes.register('my_account_auth_tokens_add', '/_admin/my_account/auth_tokens/new', []); - pyroutes.register('my_account_external_identity', '/_admin/my_account/external-identity', []); - pyroutes.register('my_account_external_identity_delete', '/_admin/my_account/external-identity/delete', []); - pyroutes.register('pullrequest_draft_comments_submit', '/%(repo_name)s/pull-request/%(pull_request_id)s/draft_comments_submit', ['repo_name', 'pull_request_id']); - pyroutes.register('commit_draft_comments_submit', '/%(repo_name)s/changeset/%(commit_id)s/draft_comments_submit', ['repo_name', 'commit_id']); - pyroutes.register('repo_artifacts_list', '/%(repo_name)s/artifacts', ['repo_name']); - pyroutes.register('repo_artifacts_data', '/%(repo_name)s/artifacts_data', ['repo_name']); - pyroutes.register('repo_artifacts_new', '/%(repo_name)s/artifacts/new', ['repo_name']); - pyroutes.register('repo_artifacts_get', '/%(repo_name)s/artifacts/download/%(uid)s', ['repo_name', 'uid']); - pyroutes.register('repo_artifacts_store', '/%(repo_name)s/artifacts/store', ['repo_name']); - pyroutes.register('repo_artifacts_info', '/%(repo_name)s/artifacts/info/%(uid)s', ['repo_name', 'uid']); - pyroutes.register('repo_artifacts_delete', '/%(repo_name)s/artifacts/delete/%(uid)s', ['repo_name', 'uid']); - pyroutes.register('repo_artifacts_update', '/%(repo_name)s/artifacts/update/%(uid)s', ['repo_name', 'uid']); - pyroutes.register('repo_automation', '/%(repo_name)s/settings/automation', ['repo_name']); - pyroutes.register('repo_automation_update', '/%(repo_name)s/settings/automation/%(entry_id)s/update', ['repo_name', 'entry_id']); - pyroutes.register('edit_repo_remote_push', '/%(repo_name)s/settings/remote/push', ['repo_name']); - pyroutes.register('edit_repo_perms_branch', '/%(repo_name)s/settings/branch_permissions', ['repo_name']); - pyroutes.register('edit_repo_perms_branch_delete', '/%(repo_name)s/settings/branch_permissions/%(rule_id)s/delete', ['repo_name', 'rule_id']); + pyroutes.register('user_groups', '/_admin/user_groups', []); + pyroutes.register('user_groups_create', '/_admin/user_groups/create', []); + pyroutes.register('user_groups_data', '/_admin/user_groups_data', []); + pyroutes.register('user_groups_delete', '/_admin/user_groups/%(user_group_id)s/delete', ['user_group_id']); + pyroutes.register('user_groups_new', '/_admin/user_groups/new', []); + pyroutes.register('user_groups_update', '/_admin/user_groups/%(user_group_id)s/update', ['user_group_id']); + pyroutes.register('user_notice_dismiss', '/_admin/users/%(user_id)s/notice_dismiss', ['user_id']); + pyroutes.register('user_profile', '/_profiles/%(username)s', ['username']); + pyroutes.register('user_update', '/_admin/users/%(user_id)s/update', ['user_id']); + pyroutes.register('users', '/_admin/users', []); + pyroutes.register('users_create', '/_admin/users/create', []); + pyroutes.register('users_data', '/_admin/users_data', []); + pyroutes.register('users_new', '/_admin/users/new', []); } diff --git a/rhodecode/subscribers.py b/rhodecode/subscribers.py --- a/rhodecode/subscribers.py +++ b/rhodecode/subscribers.py @@ -233,7 +233,7 @@ def write_usage_data(event): # write every 6th hour if age_in_min and age_in_min < 60 * 6: - log.debug('Usage file created %s minutes ago, skipping (threashold: %s)...', + log.debug('Usage file created %s minutes ago, skipping (threshold: %s minutes)...', age_in_min, 60 * 6) return