Mercurial > kallithea
changeset 6238:d5b837c8b451
users: use the form URL for POST so the htmlfill error page URL will be the same as the initial form URL.
This also reveals that a test used a GET route for POST - they just happened to
be the same.
These problems can probably be found in many places - there should be a general
cleanup.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Sun, 25 Sep 2016 17:21:07 +0200 |
parents | e55041bb3585 |
children | fa85c3df571b |
files | kallithea/config/routing.py kallithea/templates/admin/users/user_add.html kallithea/tests/functional/test_admin_users.py |
diffstat | 3 files changed, 12 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/config/routing.py Sun Sep 25 17:21:07 2016 +0200 +++ b/kallithea/config/routing.py Sun Sep 25 17:21:07 2016 +0200 @@ -170,7 +170,7 @@ #ADMIN USER ROUTES with rmap.submapper(path_prefix=ADMIN_PREFIX, controller='admin/users') as m: - m.connect("users", "/users", + m.connect("new_user", "/users/new", action="create", conditions=dict(method=["POST"])) m.connect("users", "/users", action="index", conditions=dict(method=["GET"]))
--- a/kallithea/templates/admin/users/user_add.html Sun Sep 25 17:21:07 2016 +0200 +++ b/kallithea/templates/admin/users/user_add.html Sun Sep 25 17:21:07 2016 +0200 @@ -23,7 +23,7 @@ ${self.breadcrumbs()} </div> <!-- end box / title --> - ${h.form(url('users'))} + ${h.form(url('new_user'))} <div class="form"> <!-- fields --> <div class="fields">
--- a/kallithea/tests/functional/test_admin_users.py Sun Sep 25 17:21:07 2016 +0200 +++ b/kallithea/tests/functional/test_admin_users.py Sun Sep 25 17:21:07 2016 +0200 @@ -54,7 +54,7 @@ def test_index(self): self.log_user() response = self.app.get(url('users')) - # Test response... + # TODO: Test response... def test_create(self): self.log_user() @@ -65,7 +65,7 @@ lastname = u'lastname' email = 'mail@example.com' - response = self.app.post(url('users'), + response = self.app.post(url('new_user'), {'username': username, 'password': password, 'password_confirmation': password_confirmation, @@ -101,13 +101,14 @@ lastname = u'lastname' email = 'errmail.example.com' - response = self.app.post(url('users'), {'username': username, - 'password': password, - 'name': name, - 'active': False, - 'lastname': lastname, - 'email': email, - '_authentication_token': self.authentication_token()}) + response = self.app.post(url('new_user'), + {'username': username, + 'password': password, + 'name': name, + 'active': False, + 'lastname': lastname, + 'email': email, + '_authentication_token': self.authentication_token()}) msg = validators.ValidUsername(False, {})._messages['system_invalid_username'] msg = h.html_escape(msg % {'username': 'new_user'})