0001-general-give-a-custom-error-message-on-invalid-actio.patch
tests/test_form_pages.py | ||
---|---|---|
4964 | 4964 |
assert formdata.status == 'wf-accepted' |
4965 | 4965 | |
4966 | 4966 |
# no longer on a correct status, action url will now return a 404 |
4967 |
app.get(action_url, status=404) |
|
4967 |
resp = app.get(action_url, status=404) |
|
4968 |
assert 'This action link has already been used or has expired.' in resp.body |
|
4968 | 4969 | |
4969 | 4970 |
def test_manager_public_access(pub): |
4970 | 4971 |
user, manager = create_user_and_admin(pub) |
wcs/forms/actions.py | ||
---|---|---|
28 | 28 |
from wcs.wf.jump import jump_and_perform |
29 | 29 | |
30 | 30 | |
31 |
class MissingOrExpiredToken(errors.PublishError): |
|
32 |
status_code = 404 |
|
33 |
title = N_('Error') |
|
34 |
description = N_('This action link has already been used or has expired.') |
|
35 | ||
36 | ||
31 | 37 |
class ActionsDirectory(Directory): |
32 | 38 |
def _q_lookup(self, component): |
33 | 39 |
try: |
34 | 40 |
token = tokens.Token.get(component) |
35 | 41 |
except KeyError: |
36 |
raise errors.TraversalError()
|
|
42 |
raise MissingOrExpiredToken()
|
|
37 | 43 |
if token.type != 'action': |
38 | 44 |
raise errors.TraversalError() |
39 | 45 |
return ActionDirectory(token) |
40 |
- |