Skip to content

Commit 7912403

Browse files
committed
Another minimal refactoring...
- Legacy-Id: 784
1 parent ee50e92 commit 7912403

2 files changed

Lines changed: 3 additions & 10 deletions

File tree

ietf/ipr/search.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from ietf.idtracker.models import IETFWG, InternetDraft, Rfc
1010
from ietf.ipr.models import IprRfc, IprDraft, IprDetail
1111
from ietf.ipr.related import related_docs
12-
from ietf.utils import log, draft_search
12+
from ietf.utils import log, normalize_draftname
1313

1414

1515
def mark_last_doc(iprs):
@@ -83,7 +83,8 @@ def search(request, type="", q="", id=""):
8383
doc = q
8484
if type == "document_search":
8585
if q:
86-
start = draft_search(q)
86+
q = normalize_draftname(q)
87+
start = InternetDraft.objects.filter(filename__contains=q)
8788
if id:
8889
start = InternetDraft.objects.filter(id_document_tag=id)
8990
if type == "rfc_search":

ietf/utils/draft_search.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
# Copyright The IETF Trust 2007, All Rights Reserved
22
import re
3-
from ietf.idtracker.models import InternetDraft
43

54
def normalize_draftname(string):
65
string = string.strip()
76
string = re.sub("\.txt$","",string)
87
string = re.sub("-\d\d$","",string)
98
return string
10-
11-
def draft_search(string):
12-
drafts = []
13-
if string:
14-
string = normalize_draftname(string)
15-
drafts = InternetDraft.objects.filter(filename__contains=string)
16-
return drafts
179

0 commit comments

Comments
 (0)