-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
circular import error caused by directly import search_results method #10699
Comments
…l request to search_results view via url re #10699
Unfortunately there aren't great options here. If a project developer overrides the search view (or at least search_results method in Search view) then there are only 2 options for a fix in core arches:
There's a 3rd option for the project developer which is to also override SearchExport.py to point to the project-local SearchView's search_results method, but this feels like a hack since a project should be able to override only the views they actually want to modify. Neither of these options seem ideal so it would be great if folks could weigh in (my PR #10701 goes the https request route) to form a consensus on this issue (since it also applies more broadly to other views that may be overridden in a project but still have internal references from views that weren't overridden). |
created #10721 since through the aforementioned PR I discovered there aren't any tests for SearchResultsExporter |
Rather than using the test client to issue a request, I think this is a use case for In [1]: from django.urls import resolve, reverse
In [2]: resolve(reverse('search_results')).func
INFO:rdflib:RDFLib Version: 4.2.2
Out[2]: <function arches.app.views.search.search_results(request, returnDsl=False)> |
… it exists in Arches, prj, or app re #10699
@jacobtylerwalls thanks for an excellent suggestion! Want to review my PR? :) |
Uses django.urls resolve() to send request to search_results wherever it exists in Arches, prj, or app re #10699 Co-authored-by: Jacob Walls <[email protected]>
In
search_export.py
, thesearch_results
method from the search view is imported and used here:https://github.com/archesproject/arches/blob/dev/7.6.x/arches/app/search/search_export.py#L151
If a project overrides the search view, however, the statement importing this method results in an error due to circular imports.
The text was updated successfully, but these errors were encountered: