Skip to content

Commit

Permalink
Revert "refactor: eliminate single-use helper (ietf-tools#8226)"
Browse files Browse the repository at this point in the history
This reverts commit 6608c9d.
  • Loading branch information
jennifer-richards committed Nov 22, 2024
1 parent 19e01fe commit a1376da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ietf/doc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,10 @@ def get_replaces_tree(doc):
return sorted(history, key=lambda x: x['published'])


def get_search_cache_key(key_fragment):
return f"doc:document:search:{key_fragment}"


def build_file_urls(doc: Union[Document, DocHistory]):
if doc.type_id == "rfc":
base_path = os.path.join(settings.RFC_PATH, doc.name + ".")
Expand Down
4 changes: 2 additions & 2 deletions ietf/doc/views_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
IESG_BALLOT_ACTIVE_STATES, IESG_STATCHG_CONFLREV_ACTIVE_STATES,
IESG_CHARTER_ACTIVE_STATES )
from ietf.doc.fields import select2_id_doc_name_json
from ietf.doc.utils import augment_events_with_revision, needed_ballot_positions
from ietf.doc.utils import get_search_cache_key, augment_events_with_revision, needed_ballot_positions
from ietf.group.models import Group
from ietf.idindex.index import active_drafts_index_by_group
from ietf.name.models import DocTagName, DocTypeName, StreamName
Expand Down Expand Up @@ -292,7 +292,7 @@ def search(request):
if request.method == "POST":
form = SearchForm(data=request.POST)
if form.is_valid():
cache_key = f"doc:document:search:{form.cache_key_fragment()}"
cache_key = get_search_cache_key(form.cache_key_fragment())
cached_val = cache.get(cache_key)
if cached_val:
[results, meta] = cached_val
Expand Down

0 comments on commit a1376da

Please sign in to comment.