# HG changeset patch # User Marcin Kuzminski # Date 2017-07-24 10:28:57 # Node ID 5ee1b12e18dc967725e44ea13e91f83beccb3e31 # Parent 089c11e9eb5d429d0532b0e0bcd8033aef59349e views: fixed some view names for better usage in view whitelist access 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 @@ -270,7 +270,7 @@ class GistView(BaseAppView): @view_config( route_name='gist_show_formatted_path', request_method='GET', renderer=None) - def show(self): + def gist_show(self): gist_id = self.request.matchdict['gist_id'] # TODO(marcink): expose those via matching dict 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 @@ -43,7 +43,7 @@ def includeme(config): config.add_route( name='my_account_password_update', - pattern=ADMIN_PREFIX + '/my_account/password') + pattern=ADMIN_PREFIX + '/my_account/password/update') # my account tokens config.add_route( diff --git a/rhodecode/apps/my_account/tests/test_my_account_password.py b/rhodecode/apps/my_account/tests/test_my_account_password.py --- a/rhodecode/apps/my_account/tests/test_my_account_password.py +++ b/rhodecode/apps/my_account/tests/test_my_account_password.py @@ -37,6 +37,8 @@ def route_path(name, **kwargs): 'home': '/', 'my_account_password': ADMIN_PREFIX + '/my_account/password', + 'my_account_password_update': + ADMIN_PREFIX + '/my_account/password/update', }[name].format(**kwargs) @@ -58,7 +60,8 @@ class TestMyAccountPassword(TestControll ('__end__', 'new_password:mapping'), ('csrf_token', self.csrf_token), ] - response = self.app.post(route_path('my_account_password'), form_data).follow() + response = self.app.post( + route_path('my_account_password_update'), form_data).follow() assert 'Successfully updated password' in response # check_password depends on user being in session @@ -91,7 +94,8 @@ class TestMyAccountPassword(TestControll ('__end__', 'new_password:mapping'), ('csrf_token', self.csrf_token), ] - response = self.app.post(route_path('my_account_password'), form_data) + response = self.app.post( + route_path('my_account_password_update'), form_data) assert_response = response.assert_response() assert assert_response.get_elements('.error-block') @@ -109,7 +113,8 @@ class TestMyAccountPassword(TestControll ('__end__', 'new_password:mapping'), ('csrf_token', self.csrf_token), ] - response = self.app.post(route_path('my_account_password'), form_data) + response = self.app.post( + route_path('my_account_password_update'), form_data) assert_session_flash( response, 'Error occurred during update of user password') @@ -129,7 +134,8 @@ class TestMyAccountPassword(TestControll ('__end__', 'new_password:mapping'), ('csrf_token', self.csrf_token), ] - self.app.post(route_path('my_account_password'), form_data) + self.app.post( + route_path('my_account_password_update'), form_data) response = self.app.get(route_path('home')) session = response.get_session_from_response() 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 @@ -90,7 +90,9 @@ class MyAccountView(BaseAppView, DataGri username=c.user.username) form = forms.Form( - schema, buttons=(forms.buttons.save, forms.buttons.reset)) + schema, + action=h.route_path('my_account_password_update'), + buttons=(forms.buttons.save, forms.buttons.reset)) c.form = form return self._get_template_context(c) @@ -99,7 +101,7 @@ class MyAccountView(BaseAppView, DataGri @NotAnonymous() @CSRFRequired() @view_config( - route_name='my_account_password', request_method='POST', + 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 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 @@ -162,6 +162,9 @@ class RepoSummaryView(RepoAppView): @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() 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 @@ -39,7 +39,7 @@ class UserProfileView(BaseAppView): @view_config( route_name='user_profile', request_method='GET', renderer='rhodecode:templates/users/user.mako') - def login(self): + def user_profile(self): # register local template context c = self._get_local_tmpl_context() c.active = 'user_profile'