You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a problem with Jane when querying the REST interface for document indices and the resulting json would contain a string that is enclosed by double quotes and contains a single quote it seems. Not sure if it's the problem of a specific dependency or why this problem has not surfaced before.
The error only shows up if the index for the offending document would be part of the query result. If it isn't, the REST query works as usual.
ImproperlyConfigured at /rest/document_indices/quakeml
Could not resolve URL for hyperlinked relationship using view name "rest_documents-detail". You may have failed to include the related model in your API, or incorrectly configured the `lookup_field` attribute on this field.
Request Method: GET
Request URL: http://localhost:8000/rest/document_indices/quakeml?limit=1000&offset=89
Django Version: 1.9.13
Exception Type: ImproperlyConfigured
Exception Value:
Could not resolve URL for hyperlinked relationship using view name "rest_documents-detail". You may have failed to include the related model in your API, or incorrectly configured the `lookup_field` attribute on this field.
Exception Location: /home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/rest_framework/relations.py in to_representation, line 393
Python Executable: /home/megies/anaconda/envs/jane-rotational/bin/python3
Python Version: 3.6.5
Python Path:
['/home/megies/git/jane-rotational/src',
'/home/megies/anaconda/envs/jane-rotational/lib/python36.zip',
'/home/megies/anaconda/envs/jane-rotational/lib/python3.6',
'/home/megies/anaconda/envs/jane-rotational/lib/python3.6/lib-dynload',
'/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages',
'/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/cycler-0.10.0-py3.6.egg',
'/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/defusedxml-0.5.0-py3.6.egg']
Server time: Thu, 12 Apr 2018 14:31:54 +0000
full traceback
Environment:
Request Method: GET
Request URL: http://localhost:8000/rest/document_indices/quakeml?limit=1000&offset=89
Django Version: 1.9.13
Python Version: 3.6.5
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'djangoplugins',
'rest_framework',
'rest_framework_gis',
'corsheaders',
'debug_toolbar',
'jane.jane',
'jane.waveforms',
'jane.documents',
'jane.stationxml',
'jane.quakeml',
'jane.fdsnws']
Installed Middleware:
['django.middleware.gzip.GZipMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'jane.jane.middleware.AutoLogoutMiddleware']
Traceback:
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/rest_framework/relations.py" in to_representation
378. url = self.get_url(value, self.view_name, request, format)
File "/home/megies/git/jane-rotational/src/jane/documents/serializer.py" in get_url
45. format=format)
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/rest_framework/reverse.py" in reverse
50. url = _reverse(viewname, args, kwargs, request, format, **extra)
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/rest_framework/reverse.py" in _reverse
63. url = django_reverse(viewname, args=args, kwargs=kwargs, **extra)
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/django/core/urlresolvers.py" in reverse
600. return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/django/core/urlresolvers.py" in _reverse_with_prefix
508. (lookup_view_s, args, kwargs, len(patterns), patterns))
During handling of the above exception (Reverse for 'rest_documents-detail' with arguments '()' and keyword arguments '{'name': "GCMT_2007-08-26T134705Z_5.30_D'ENTRECASTEAUX_ISLANDS_REGION.xml", 'document_type': 'quakeml'}' not found. 1 pattern(s) tried: ['rest/documents/(?P<document_type>[a-zA-Z0-9]+)/(?P<name>[A-Za-z0-9-_.,:]+)/?$']), another exception occurred:
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/django/core/handlers/base.py" in get_response
149. response = self.process_exception_by_middleware(e, request)
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/django/core/handlers/base.py" in get_response
147. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/django/views/decorators/csrf.py" in wrapped_view
58. return view_func(*args, **kwargs)
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/rest_framework/viewsets.py" in view
90. return self.dispatch(request, *args, **kwargs)
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/rest_framework/views.py" in dispatch
489. response = self.handle_exception(exc)
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/rest_framework/views.py" in handle_exception
449. self.raise_uncaught_exception(exc)
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/rest_framework/views.py" in dispatch
486. response = handler(request, *args, **kwargs)
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/rest_framework/mixins.py" in list
45. return self.get_paginated_response(serializer.data)
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/rest_framework/serializers.py" in data
739. ret = super(ListSerializer, self).data
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/rest_framework/serializers.py" in data
263. self._data = self.to_representation(self.instance)
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/rest_framework/serializers.py" in to_representation
657. self.child.to_representation(item) for item in iterable
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/rest_framework/serializers.py" in <listcomp>
657. self.child.to_representation(item) for item in iterable
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/rest_framework/serializers.py" in to_representation
501. ret[field.field_name] = field.to_representation(attribute)
File "/home/megies/anaconda/envs/jane-rotational/lib/python3.6/site-packages/rest_framework/relations.py" in to_representation
393. raise ImproperlyConfigured(msg % self.view_name)
Exception Type: ImproperlyConfigured at /rest/document_indices/quakeml
Exception Value: Could not resolve URL for hyperlinked relationship using view name "rest_documents-detail". You may have failed to include the related model in your API, or incorrectly configured the `lookup_field` attribute on this field.
There is a problem with Jane when querying the REST interface for document indices and the resulting json would contain a string that is enclosed by double quotes and contains a single quote it seems. Not sure if it's the problem of a specific dependency or why this problem has not surfaced before.
The error only shows up if the index for the offending document would be part of the query result. If it isn't, the REST query works as usual.
REST query:
http://localhost:8000/rest/document_indices/quakeml?limit=1000&offset=89
Error traceback:
full traceback
This is the file that was causing the problem:
GCMT_2015-07-14T021007Z_4.90_D'ENTRECASTEAUX_ISLANDS_REGION.xml.zip
conda env info
The text was updated successfully, but these errors were encountered: