4343import sys
4444
4545def all_id_txt ():
46- all_ids = InternetDraft .objects .order_by ('filename' )
47- in_track_ids = all_ids .filter (idinternal__rfc_flag = 0 ).exclude (idinternal__cur_state__in = IDInternal .INACTIVE_STATES )
48- exclude_ids = [item .id_document_tag for item in in_track_ids ]
49- not_in_track = all_ids .exclude (id_document_tag__in = exclude_ids )
50- active = not_in_track .filter (status__status_id = IDInternal .ACTIVE )
51- published = not_in_track .filter (status__status_id = IDInternal .PUBLISHED )
52- expired = not_in_track .filter (status__status_id = IDInternal .EXPIRED )
53- withdrawn_submitter = not_in_track .filter (status__status_id = IDInternal .WITHDRAWN_SUBMITTER )
54- withdrawn_ietf = not_in_track .filter (status__status_id = IDInternal .WITHDRAWN_IETF )
55- replaced = not_in_track .filter (status__status_id = IDInternal .REPLACED )
46+ # we need a distinct to prevent the queries below from multiplying the result
47+ all_ids = InternetDraft .objects .order_by ('name' ).exclude (name__startswith = "rfc" ).distinct ()
48+
49+ inactive_states = ["pub" , "watching" , "dead" ]
50+
51+ in_track_ids = all_ids .exclude (states__type = "draft" , states__slug = "rfc" ).filter (states__type = "draft-iesg" ).exclude (states__type = "draft-iesg" , states__slug__in = inactive_states )
52+ not_in_track = all_ids .filter (states__type = "draft" , states__slug = "rfc" ) | all_ids .exclude (states__type = "draft-iesg" ) | all_ids .filter (states__type = "draft-iesg" , states__slug__in = inactive_states )
53+
54+ active = not_in_track .filter (states__type = "draft" , states__slug = "active" )
55+ published = not_in_track .filter (states__type = "draft" , states__slug = "rfc" )
56+ expired = not_in_track .filter (states__type = "draft" , states__slug = "expired" )
57+ withdrawn_submitter = not_in_track .filter (states__type = "draft" , states__slug = "auth-rm" )
58+ withdrawn_ietf = not_in_track .filter (states__type = "draft" , states__slug = "ietf-rm" )
59+ replaced = not_in_track .filter (states__type = "draft" , states__slug = "repl" )
5660
5761 return loader .render_to_string ("idindex/all_ids.txt" ,
5862 { 'in_track_ids' :in_track_ids ,
@@ -68,9 +72,9 @@ def all_id2_entry(id):
6872 # 0
6973 fields .append (id .filename + "-" + id .revision_display ())
7074 # 1
71- fields .append (id .id_document_tag )
75+ fields .append (- 1 ) # this used to be id.id_document_tag, we don't have this identifier anymore
7276 # 2
73- status = id .status . status
77+ status = str ( id .get_state ())
7478 fields .append (status )
7579 # 3
7680 iesgstate = id .idstate () if status == "Active" else ""
@@ -92,24 +96,17 @@ def all_id2_entry(id):
9296
9397 # 8
9498 area = ""
95- if id .idinternal :
96- try :
97- area = id .idinternal .area_acronym
98- except Area .DoesNotExist :
99- pass
100- elif not group_acronym :
101- pass
102- else :
103- try :
104- area = id .group .ietfwg .area_acronym ()
105- except IETFWG .DoesNotExist :
106- area = ""
99+ if id .group .type_id == "area" :
100+ area = id .group .acronym
101+ elif id .group .type_id == "wg" and id .group .parent :
102+ area = id .group .parent .acronym
107103 fields .append (area )
108104 # 9
109105 fields .append (id .idinternal .job_owner if id .idinternal else "" )
110106 # 10
111- if id .intended_status and id .intended_status .intended_status not in ("None" ,"Request" ):
112- fields .append (id .intended_status .intended_status )
107+ s = id .intended_status
108+ if s and str (s ) not in ("None" ,"Request" ):
109+ fields .append (str (s ))
113110 else :
114111 fields .append ("" )
115112 # 11
@@ -132,11 +129,13 @@ def all_id2_entry(id):
132129 except PersonOrOrgInfo .DoesNotExist :
133130 pass
134131 fields .append (u", " .join (authors ))
132+
135133 return "\t " .join ([unicode (x ) for x in fields ])
136134
137135def all_id2_txt ():
138- all_ids = InternetDraft .objects .order_by ('filename' ).select_related ('status__status' ,'group__acronym' ,'intended_status__intended_status' )
139- data = "\n " .join ([all_id2_entry (id ) for id in all_ids ])
136+ all_ids = InternetDraft .objects .order_by ('name' ).exclude (name__startswith = "rfc" ).select_related ('group' , 'group__parent' , 'ad' )
137+ data = "\n " .join (all_id2_entry (id ) for id in all_ids )
138+
140139 return loader .render_to_string ("idindex/all_id2.txt" ,{'data' :data })
141140
142141def id_index_txt ():
0 commit comments