-
Notifications
You must be signed in to change notification settings - Fork 460
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
feat: POST for document search requests #8206
feat: POST for document search requests #8206
Conversation
Changes the search view to use a POST instead of a GET. Refactors cache key computation to use cleaned data. Still todo: * refactor frontpage view to match * refactor menubar search (?) * refactor stats view that uses SearchForm * revive or drop the "backwards compatibility" branch
Still todo: * refactor frontpage view to match * refactor menubar search (?) * refactor stats view that uses SearchForm
Still todo: * refactor stats view that uses SearchForm
ietf/doc/views_stats.py
Outdated
@@ -124,14 +124,11 @@ def chart_newrevisiondocevent(request): | |||
|
|||
#@cache_page(60*15) | |||
def chart_data_newrevisiondocevent(request): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure this doesn't work as intended, and it's not being used, so lets remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removal done in #8210
Marking as draft until #8210 is merged. I'll pull that into this branch and do cleanup here. |
# Conflicts: # ietf/doc/views_stats.py
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8206 +/- ##
==========================================
+ Coverage 88.78% 88.94% +0.15%
==========================================
Files 296 303 +7
Lines 41320 41260 -60
==========================================
+ Hits 36687 36699 +12
+ Misses 4633 4561 -72 ☔ View full report in Codecov by Sentry. |
This refactors the
ietf.doc.search()
view and some adjacent views to require a POST, including a CSRF key, before executing a document search. Search parameters are expected in the request body instead of the URL query string.If a GET request with a query string is received the search is not executed. The user is sent back to the search page with the form pre-filled using the values from their request and an error box at the top of the page indicates that the GET interface is deprecated. (Maybe there's a better term - it's actually been retired - so suggestions on phrasing are welcome.)
I've refactored the cache key calculation and moved it into the
SearchForm
since it depends on details internal to the form. This helps with a circular import problem.The
SearchForm
and results cache is reused in the stats module. I've so far refactored this to use the updated form but not to switch it over to POST. I haven't seen anything actually hit that endpoint in over 30 days (though I haven't exhaustively searched logs), so maybe it's better to drop it. That'd allow removal of an additional helper function that really doesn't need to exist.A few things left before taking this out of draft:
messages.error()
notice to reflect that the GET interface is retired, not just deprecated/doc/<some-value>
are all covered by this patchsearch_for_name
view is probably in need of a refactor, but it's really a separate task so I'm not going to change it here./doc/whatever
as an alias for searching.It'd also be nice to update the
search_form.html
template to display form validation errors. I'm on the fence as to whether that's a separate feature or belongs here. Thinking it is probably separate and that the better fix should also handle opening the "Additional search criteria" accordion when non-default options are selected.