3737from django .template import RequestContext , loader
3838from django .http import HttpResponse
3939from ietf .idrfc .views_search import SearchForm , search_query
40- from ietf .idrfc .idrfc_wrapper import IdRfcWrapper
40+ from ietf .idrfc .idrfc_wrapper import IdRfcWrapper , RfcWrapper , IdWrapper
4141from ietf .ipr .models import IprDetail
42+ from ietf .idrfc .models import RfcIndex
43+ from ietf .idtracker .models import InternetDraft
4244
4345
4446def wg_summary_acronym (request ):
@@ -65,27 +67,37 @@ def wg_dir(request):
6567def wg_documents (request , acronym ):
6668 wg = get_object_or_404 (IETFWG , group_acronym__acronym = acronym , group_type = 1 )
6769 concluded = (wg .status_id != 1 )
68- form = SearchForm ({'by' :'group' , 'group' :str (wg .group_acronym .acronym ),
69- 'rfcs' :'on' , 'activeDrafts' :'on' })
70- if not form .is_valid ():
71- raise ValueError ("form did not validate" )
72- (docs ,meta ) = search_query (form .cleaned_data )
7370
74- # get the related docs
75- form_related = SearchForm ({'by' :'group' , 'name' :'-' + str (wg .group_acronym .acronym )+ '-' , 'activeDrafts' :'on' })
76- if not form_related .is_valid ():
77- raise ValueError ("form_related did not validate" )
78- (docs_related ,meta_related ) = search_query (form_related .cleaned_data )
71+ # get RFCs
72+ rfcs = RfcIndex .objects .filter ( wg = wg .group_acronym .acronym )
73+ docs = []
74+ for r in rfcs :
75+ rw = RfcWrapper (r )
76+ idrfc = IdRfcWrapper (None , rw )
77+ docs .append ( idrfc )
78+
79+ # get the WG drafts
80+ drafts = InternetDraft .objects .filter ( group__acronym = wg .group_acronym .acronym , status__status = 'Active' )
81+
82+ for id in drafts :
83+ dw = IdWrapper (id )
84+ d = IdRfcWrapper ( dw , None )
85+ docs .insert (0 , d )
86+
87+ # now get the related docs
7988 docs_related_pruned = []
80- for d in docs_related :
89+ related = InternetDraft .objects .filter ( filename__contains = wg .group_acronym .acronym , status__status = 'Active' )
90+ for r in related :
91+ dw = IdWrapper (r )
92+ d = IdRfcWrapper ( dw , None )
8193 parts = d .id .draft_name .split ("-" , 2 );
8294 # canonical form draft-<name|ietf>-wg-etc
8395 if ( len (parts ) >= 3 ):
8496 if parts [1 ] != "ietf" and parts [2 ].startswith (wg .group_acronym .acronym + "-" ):
8597 docs_related_pruned .append (d )
86-
87- return render_to_response ('wginfo/wg_documents.html' , {'wg' : wg , 'concluded' :concluded , 'selected' :'documents' , 'docs' :docs , 'meta' : meta ,
88- 'docs_related' :docs_related_pruned , 'meta_related' : meta_related }, RequestContext (request ))
98+
99+ return render_to_response ('wginfo/wg_documents.html' , {'wg' : wg , 'concluded' :concluded , 'selected' :'documents' , 'docs' :docs ,
100+ 'docs_related' :docs_related_pruned }, RequestContext (request ))
89101
90102def wg_charter (request , acronym ):
91103 wg = get_object_or_404 (IETFWG , group_acronym__acronym = acronym , group_type = 1 )
0 commit comments