Skip to content

Commit 6afceb8

Browse files
committed
Port idindex to new schema, fixes ietf-tools#770.
- Legacy-Id: 3985
1 parent 95fc209 commit 6afceb8

3 files changed

Lines changed: 31 additions & 29 deletions

File tree

ietf/doc/proxy.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,9 @@ def ballot_others(self):
495495
def docstate(self):
496496
s = self.get_state("draft-iesg")
497497
if s:
498+
subs = self.cur_sub_state
499+
if subs:
500+
return "%s::%s" % (s.name, subs)
498501
return s.name
499502
else:
500503
return "I-D Exists"

ietf/idindex/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
(r'^all_id(?:_txt)?.html$', 'django.views.generic.simple.redirect_to', { 'url': 'http://www.ietf.org/id/all_id.txt' }),
1818
)
1919

20-
if settings.SERVER_MODE != 'production' and not settings.USE_DB_REDESIGN_PROXY_CLASSES:
20+
if settings.SERVER_MODE != 'production':
2121
# these haven't been ported
2222
urlpatterns += patterns('',
2323
(r'^_test/all_id.txt$', views.test_all_id_txt),

ietf/idindex/views.py

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,20 @@
4343
import sys
4444

4545
def 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

137135
def 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

142141
def id_index_txt():

0 commit comments

Comments
 (0)