0001-wcs-don-t-crash-manager-getting-list-of-options-when.patch
combo/apps/wcs/utils.py | ||
---|---|---|
27 | 27 |
return settings.KNOWN_SERVICES.get('wcs') |
28 | 28 | |
29 | 29 |
def get_wcs_json(wcs_site, path): |
30 |
return requests.get(path, remote_service=wcs_site, without_user=True, |
|
31 |
headers={'accept': 'application/json'}).json() |
|
30 |
response = requests.get(path, remote_service=wcs_site, without_user=True, |
|
31 |
headers={'accept': 'application/json'}) |
|
32 |
if response.status_code != 200: |
|
33 |
# the exact error will have been logged during request. |
|
34 |
return {} |
|
35 |
return response.json() |
|
32 | 36 | |
33 | 37 |
def get_wcs_options(url, include_category_slug=False): |
34 | 38 |
references = [] |
... | ... | |
39 | 43 |
if response_json.get('err') == 1: |
40 | 44 |
continue |
41 | 45 |
response_json = response_json.get('data') |
46 |
if not response_json: |
|
47 |
continue |
|
42 | 48 |
for element in response_json: |
43 | 49 |
slug = element.get('slug') |
44 | 50 |
title = element.get('title') |
45 |
- |