1111from ietf .idtracker .models import Acronym , IETFWG , InternetDraft , Rfc
1212from ietf .idindex .forms import IDIndexSearchForm
1313from ietf .idindex .models import alphabet , orgs , orgs_dict
14- from ietf .utils import orl , flattenl
14+ from ietf .utils import orl , flattenl , normalize_draftname
1515
1616base_extra = { 'alphabet' : alphabet , 'orgs' : orgs }
1717
@@ -101,6 +101,9 @@ def showdocs(request, cat=None):
101101
102102
103103def search (request ):
104+ args = request .GET .copy ()
105+ if args .has_key ('filename' ):
106+ args ['filename' ] = normalize_draftname (args ['filename' ])
104107 form = IDIndexSearchForm ()
105108 t = loader .get_template ('idindex/search.html' )
106109 # if there's a query, do the search and supply results to the template
@@ -113,20 +116,20 @@ def search(request):
113116 'first_name' : 'authors__person__first_name__icontains' ,
114117 }
115118 for key in qdict .keys () + ['other_group' ]:
116- if key in request . REQUEST :
119+ if key in args :
117120 searching = True
118121 if searching :
119122 # '0' and '-1' are flag values for "any"
120123 # in the original .cgi search page.
121124 # They are compared as strings because the
122125 # query dict is always strings.
123- q_objs = [Q (** {qdict [k ]: request . REQUEST [k ]})
126+ q_objs = [Q (** {qdict [k ]: args [k ]})
124127 for k in qdict .keys ()
125- if request . REQUEST .get (k , '' ) != '' and
126- request . REQUEST [k ] != '0' and
127- request . REQUEST [k ] != '-1' ]
128+ if args .get (k , '' ) != '' and
129+ args [k ] != '0' and
130+ args [k ] != '-1' ]
128131 try :
129- other = orgs_dict [request . REQUEST ['other_group' ]]
132+ other = orgs_dict [args ['other_group' ]]
130133 q_objs += [orl (
131134 [Q (filename__istartswith = "draft-%s-" % p )|
132135 Q (filename__istartswith = "draft-ietf-%s-" % p )
0 commit comments