refactor: eliminate single-use helper (#8226)

This commit is contained in:
Jennifer Richards 2024-11-18 10:53:50 -04:00 committed by GitHub
parent b07d4dbebc
commit 6608c9d530
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 6 deletions

View file

@ -1046,10 +1046,6 @@ def make_rev_history(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 + ".")

View file

@ -65,7 +65,7 @@ from ietf.doc.models import ( Document, DocHistory, State,
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 get_search_cache_key, augment_events_with_revision, needed_ballot_positions
from ietf.doc.utils import 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
@ -292,7 +292,7 @@ def search(request):
if request.method == "POST":
form = SearchForm(data=request.POST)
if form.is_valid():
cache_key = get_search_cache_key(form.cache_key_fragment())
cache_key = f"doc:document:search:{form.cache_key_fragment()}"
cached_val = cache.get(cache_key)
if cached_val:
[results, meta] = cached_val