0001-misc-don-t-crash-on-json-data-sources-using-lists-46.patch
tests/test_datasource.py | ||
---|---|---|
177 | 177 |
json_file.close() |
178 | 178 |
assert data_sources.get_items(datasource) == [] |
179 | 179 | |
180 |
# json file not using dictionaries |
|
181 |
get_request().datasources_cache = {} |
|
182 |
json_file = open(json_file_path, 'w') |
|
183 |
json.dump({'data': [['1', 'foo'], ['2', 'bar']]}, json_file) |
|
184 |
json_file.close() |
|
185 |
assert data_sources.get_items(datasource) == [] |
|
186 | ||
180 | 187 |
# a good json file |
181 | 188 |
get_request().datasources_cache = {} |
182 | 189 |
json_file = open(json_file_path, 'w') |
wcs/data_sources.py | ||
---|---|---|
162 | 162 |
else: |
163 | 163 |
for item in entries.get('data'): |
164 | 164 |
# skip malformed items |
165 |
if not isinstance(item, dict): |
|
166 |
continue |
|
165 | 167 |
if item.get('id') is None or item.get('id') == '': |
166 | 168 |
continue |
167 | 169 |
if 'text' not in item: |
168 |
- |