0001-misc-always-allow-restoring-drafts-37107.patch
tests/test_form_pages.py | ||
---|---|---|
1965 | 1965 | |
1966 | 1966 |
assert '2012-02-12' in resp.body |
1967 | 1967 | |
1968 |
def test_form_direct_draft_access(pub): |
|
1968 |
@pytest.mark.parametrize('tracking_code', [True, False]) |
|
1969 |
def test_form_direct_draft_access(pub, tracking_code): |
|
1969 | 1970 |
user = create_user(pub) |
1970 | 1971 |
formdef = create_formdef() |
1971 | 1972 |
formdef.fields = [fields.StringField(id='0', label='string')] |
1972 |
formdef.enable_tracking_codes = True
|
|
1973 |
formdef.enable_tracking_codes = tracking_code
|
|
1973 | 1974 |
formdef.store() |
1974 | 1975 | |
1975 | 1976 |
formdata = formdef.data_class()() |
wcs/forms/root.py | ||
---|---|---|
1286 | 1286 |
return redirect(get_publisher().get_backoffice_url() + '/submission/') |
1287 | 1287 |
return PublicFormStatusPage(self.formdef, filled) |
1288 | 1288 | |
1289 |
# restore draft |
|
1289 | 1290 |
session = get_session() |
1290 |
if not (get_request().is_in_backoffice() or |
|
1291 |
self.has_draft_support() or |
|
1292 |
session.is_anonymous_submitter(filled)): |
|
1293 |
# don't allow restoring drafts if drafts are no longer enabled for |
|
1294 |
# this form. |
|
1295 |
raise errors.AccessForbiddenError() |
|
1296 | ||
1297 | 1291 |
if not (get_request().is_in_backoffice() and filled.backoffice_submission): |
1298 | 1292 |
if session.is_anonymous_submitter(filled): |
1299 | 1293 |
pass |
1300 |
- |