Error when listing routes using the API
- Dominant language
- Python
- Stars
- 26
- Forks
- 28
- Avg merge
- 4h
- Merged PRs (30d)
- 9
Description
@Courgetteandratatouille has reported that http://api.demov6.camptocamp.org/routes?bbox=-416959,4460171,1216958,6739828&pl=fr returned an API error:
```
"errors": [
{
"description": "please consult the server logs",
"location": "body",
"name": "unexpected error"
}
],
"status": "error"
}
```
(ditto with no param).
There is probably an integrity error with a route created using the mobile app, perhaps because of a flaw in the API validations.
The logs say:
```
Traceback (most recent call last):\n
File \"/var/www/.build/venv/lib/python3.4/site-packages/c2corg_common/utils/caching.py\", line 51, in get_or_create_multi\n should_cache_fn=should_cache_fn)\n
File \"/var/www/.build/venv/lib/python3.4/site-packages/dogpile/cache/region.py\", line 937, in get_or_create_multi\n new_values = creator(*keys_to_get)\n
File \"/var/www/.build/venv/lib/python3.4/site-packages/c2corg_common/utils/caching.py\", line 113, in fn\n raise CreatorException(exc)\nc2corg_common.utils.caching.CreatorException: 'NoneType' object has no attribute 'get'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n
File \"/var/www/.build/venv/lib/python3.4/site-packages/pyramid/tweens.py\", line 22, in excview_tween\n response = handler(request)\n
File \"/var/www/.build/venv/lib/python3.4/site-packages/pyramid_tm/__init__.py\", line 109, in tm_tween\n reraise(*exc_info)\n
File \"/var/www/.build/venv/lib/python3.4/site-packages/pyramid_tm/compat.py\", line 15, in reraise\n raise value\n
File \"/var/www/.build/venv/lib/python3.4/site-packages/pyramid_tm/__init__.py\", line 88, in tm_tween\n response = handler(request)\n
File \"/var/www/.build/venv/lib/python3.4/site-packages/pyramid/router.py\", line 158, in handle_request\n view_name\n
File \"/var/www/.build/venv/lib/python3.4/site-packages/pyramid/view.py\", line 547, in _call_view\n response = view_callable(context, request)\n File \"/var/www/.build/venv/lib/python3.4/site-packages/pyramid/config/views.py\", line 182, in __call__\n return view(context, request)\n
File \"/var/www/.build/venv/lib/python3.4/site-packages/pyramid/viewderivers.py\", line 393, in attr_view\n return view(context, request)\n
File \"/var/www/.build/venv/lib/python3.4/site-packages/pyramid/viewderivers.py\", line 371, in predicate_wrapper\n return view(context, request)\n
File \"/var/www/.build/venv/lib/python3.4/site-packages/pyramid/viewderivers.py\", line 442, in rendered_view\n result = view(context, request)\n
File \"/var/www/.build/venv/lib/python3.4/site-packages/pyramid/viewderivers.py\", line 147, in _requestonly_view\n response = view(request)\n
File \"/var/www/.build/venv/lib/python3.4/site-packages/cornice/service.py\", line 485, in wrapper\n response = view_()\n
File \"/var/www/c2corg_api/views/route.py\", line 91, in collection_get\n return self._collection_get(ROUTE_TYPE, route_documents_config)\n
File \"/var/www/c2corg_api/views/document.py\", line 87, in _collection_get\n documents_config, meta_params, search_documents)\n
File \"/var/www/c2corg_api/views/document_listings.py\", line 71, in get_documents\n should_cache_fn=lambda v: v is not None)\n
File \"/var/www/.build/venv/lib/python3.4/site-packages/c2corg_common/utils/caching.py\", line 55, in get_or_create_multi\n raise creator_exception.exc\n
File \"/var/www/.build/venv/lib/python3.4/site-packages/c2corg_common/utils/caching.py\", line 111, in fn\n return creator(*args, **kwargs)\n
File \"/var/www/c2corg_api/views/document_listings.py\", line 60, in get_documents_from_cache_keys\n ids, base_query, documents_config, lang)\n
File \"/var/www/c2corg_api/views/document_listings.py\", line 138, in _get_documents_from_ids\n ) if doc else None for doc in documents\n
File \"/var/www/c2corg_api/views/document_listings.py\", line 138, in \n ) if doc else None for doc in documents\n
File \"/var/www/c2corg_api/views/document_schemas.py\", line 99, in adapt_schema\n getattr(document, type_field), field_list_type)\n
File \"/var/www/c2corg_api/views/document_schemas.py\", line 194, in adapt_route_schema_for_activities\n fields = get_all_fields(fields_route, activities, field_list_type)\n
File \"/var/www/c2corg_api/views/document_schemas.py\", line 107, in get_all_fields\n fields.get(activity).get(field_list_type) for activity in activities\n
File \"/var/www/c2corg_api/views/document_schemas.py\", line 107, in \n fields.get(activity).get(field_list_type) for activity in activities\nAttributeError: 'NoneType' object has no attribute 'get'"}
```
The error occuring at https://github.com/c2corg/v6_api/blob/master/c2corg_api/views/document_schemas.py#L107
https://github.com/c2corg/v6_api/blob/master/c2corg_api/views/document_schemas.py#L194
Perhaps a problem with the activities of a recently created route?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.