0001-api-raise-bad-request-when-full-on-is-given-to-globa.patch
tests/api/test_formdata.py | ||
---|---|---|
1200 | 1200 |
# check error handling |
1201 | 1201 |
get_url('/api/forms/?status=done&limit=plop', status=400) |
1202 | 1202 |
get_url('/api/forms/?status=done&offset=plop', status=400) |
1203 |
get_url('/api/forms/?full=on', status=400) |
|
1203 | 1204 | |
1204 | 1205 |
# check when there are missing statuses |
1205 | 1206 |
for formdata in data_class.select(): |
wcs/api.py | ||
---|---|---|
25 | 25 |
from django.utils.encoding import force_text |
26 | 26 |
from quixote import get_publisher, get_request, get_response, get_session |
27 | 27 |
from quixote.directory import Directory |
28 |
from quixote.errors import MethodNotAllowedError |
|
28 |
from quixote.errors import MethodNotAllowedError, RequestError
|
|
29 | 29 | |
30 | 30 |
import wcs.qommon.storage as st |
31 | 31 |
from wcs.admin.settings import UserFieldsFormDef |
... | ... | |
388 | 388 |
self.check_access() |
389 | 389 |
get_request()._user = get_user_from_api_query_string() or get_request().user |
390 | 390 | |
391 |
if get_request().form.get('full') == 'on': |
|
392 |
raise RequestError('so such parameter (full)') |
|
393 | ||
391 | 394 |
if FormDef.count() == 0: |
392 | 395 |
# early return, this avoids running a query against a missing SQL view. |
393 | 396 |
get_response().set_content_type('application/json') |
394 |
- |