changeset 6086:ad41c9a72a88

routing: use POST to 'delete_repo' instead of DELETE
author Mads Kiilerich <madski@unity3d.com>
date Thu, 04 Aug 2016 14:23:36 +0200
parents 5e836bd9b5d4
children 5f481679ed2b
files kallithea/config/routing.py kallithea/templates/admin/repos/repo_edit_advanced.html kallithea/templates/data_table/_dt_elements.html kallithea/tests/functional/test_admin_repos.py kallithea/tests/functional/test_admin_users.py kallithea/tests/functional/test_forks.py
diffstat 6 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/config/routing.py	Thu Aug 04 14:23:36 2016 +0200
+++ b/kallithea/config/routing.py	Thu Aug 04 14:23:36 2016 +0200
@@ -122,9 +122,8 @@
         m.connect("put_repo", "/repos/{repo_name:.*?}",
                   action="update", conditions=dict(method=["PUT"],
                   function=check_repo))
-        m.connect("delete_repo", "/repos/{repo_name:.*?}",
-                  action="delete", conditions=dict(method=["DELETE"],
-                  ))
+        m.connect("delete_repo", "/repos/{repo_name:.*?}/delete",
+                  action="delete", conditions=dict(method=["POST"]))
 
     #ADMIN REPOSITORY GROUPS ROUTES
     with rmap.submapper(path_prefix=ADMIN_PREFIX,
--- a/kallithea/templates/admin/repos/repo_edit_advanced.html	Thu Aug 04 14:23:36 2016 +0200
+++ b/kallithea/templates/admin/repos/repo_edit_advanced.html	Thu Aug 04 14:23:36 2016 +0200
@@ -73,7 +73,7 @@
 ${h.end_form()}
 
 <h3>${_('Delete')}</h3>
-${h.form(url('delete_repo', repo_name=c.repo_name), method='delete')}
+${h.form(url('delete_repo', repo_name=c.repo_name))}
 <div class="form">
     <button class="btn btn-small btn-danger" type="submit"
             onclick="return confirm('${_('Confirm to delete this repository: %s') % c.repo_name}');">
--- a/kallithea/templates/data_table/_dt_elements.html	Thu Aug 04 14:23:36 2016 +0200
+++ b/kallithea/templates/data_table/_dt_elements.html	Thu Aug 04 14:23:36 2016 +0200
@@ -124,7 +124,7 @@
       </a>
     </div>
     <div style="float:left" class="grid_delete">
-      ${h.form(h.url('delete_repo', repo_name=repo_name), method='delete')}
+      ${h.form(h.url('delete_repo', repo_name=repo_name))}
         <i class="icon-minus-circled" style="color:#FF4444"></i>
         ${h.submit('remove_%s' % repo_name,_('Delete'),class_="action_button",
         onclick="return confirm('"+_('Confirm to delete this repository: %s') % repo_name+"');")}
--- a/kallithea/tests/functional/test_admin_repos.py	Thu Aug 04 14:23:36 2016 +0200
+++ b/kallithea/tests/functional/test_admin_repos.py	Thu Aug 04 14:23:36 2016 +0200
@@ -357,7 +357,7 @@
             pytest.fail('no repo %s in filesystem' % repo_name)
 
         response = self.app.post(url('delete_repo', repo_name=repo_name),
-            params={'_method': 'delete', '_authentication_token': self.authentication_token()})
+            params={'_authentication_token': self.authentication_token()})
 
         self.checkSessionFlash(response, 'Deleted repository %s' % (repo_name))
 
@@ -409,7 +409,7 @@
             pytest.fail('no repo %s in filesystem' % repo_name)
 
         response = self.app.post(url('delete_repo', repo_name=repo_name),
-            params={'_method': 'delete', '_authentication_token': self.authentication_token()})
+            params={'_authentication_token': self.authentication_token()})
         self.checkSessionFlash(response, 'Deleted repository %s' % (repo_name_unicode))
         response.follow()
 
@@ -427,7 +427,7 @@
 
     def test_delete_browser_fakeout(self):
         response = self.app.post(url('delete_repo', repo_name=self.REPO),
-                                 params=dict(_method='delete', _authentication_token=self.authentication_token()))
+                                 params=dict(_authentication_token=self.authentication_token()))
 
     def test_show(self):
         self.log_user()
--- a/kallithea/tests/functional/test_admin_users.py	Thu Aug 04 14:23:36 2016 +0200
+++ b/kallithea/tests/functional/test_admin_users.py	Thu Aug 04 14:23:36 2016 +0200
@@ -194,7 +194,7 @@
                                '%s' % (username, reponame))
 
         response = self.app.post(url('delete_repo', repo_name=reponame),
-            params={'_method': 'delete', '_authentication_token': self.authentication_token()})
+            params={'_authentication_token': self.authentication_token()})
         self.checkSessionFlash(response, 'Deleted repository %s' % reponame)
 
         response = self.app.post(url('delete_user', id=new_user.user_id),
--- a/kallithea/tests/functional/test_forks.py	Thu Aug 04 14:23:36 2016 +0200
+++ b/kallithea/tests/functional/test_forks.py	Thu Aug 04 14:23:36 2016 +0200
@@ -85,7 +85,7 @@
 
         # remove this fork
         response = self.app.post(url('delete_repo', repo_name=fork_name),
-            params={'_method': 'delete', '_authentication_token': self.authentication_token()})
+            params={'_authentication_token': self.authentication_token()})
 
     def test_fork_create_into_group(self):
         self.log_user()