Skip to content

Commit

Permalink
Merged in Roberts django-based replacement for the old perl script ge…
Browse files Browse the repository at this point in the history
…nerating all_id.txt

 - Legacy-Id: 1398
  • Loading branch information
levkowetz committed Mar 21, 2009
1 parent 691bf06 commit e196187
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
33 changes: 33 additions & 0 deletions ietf/bin/generate-allid-txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env python

from django.template.loader import render_to_string

from ietf.idtracker.models import IDInternal
from ietf.idtracker.models import InternetDraft
from ietf.idtracker.models import IDStatus


# This block feels to me like it still knows _way_ too much about the insides of the model - should all of it be moved into the model itself?
# select_related actually causes the wrong thing to happen because of reference problems in the tables
#all_ids = InternetDraft.objects.order_by('filename').select_related(depth=1)
all_ids = InternetDraft.objects.order_by('filename')
in_track_ids = all_ids.filter(idinternal__rfc_flag=0).exclude(idinternal__cur_state__in=IDInternal.INACTIVE_STATES)
exclude_ids = [item.id_document_tag for item in in_track_ids]
not_in_track = all_ids.exclude(id_document_tag__in=exclude_ids)
active = not_in_track.filter(status__status_id=IDInternal.ACTIVE)
published = not_in_track.filter(status__status_id=IDInternal.PUBLISHED)
expired = not_in_track.filter(status__status_id=IDInternal.EXPIRED)
withdrawn_submitter = not_in_track.filter(status__status_id=IDInternal.WITHDRAWN_SUBMITTER)
withdrawn_ietf = not_in_track.filter(status__status_id=IDInternal.WITHDRAWN_IETF)
replaced = not_in_track.filter(status__status_id=IDInternal.REPLACED)

# If all of that moved, then this file would just be the following line, with, for example, the bare
# in_track_ids turned into something like InternetDraft.in_track_ids()

print render_to_string("idindex/all_ids.txt",{ 'in_track_ids':in_track_ids,
'active':active,
'published':published,
'expired':expired,
'withdrawn_submitter':withdrawn_submitter,
'withdrawn_ietf':withdrawn_ietf,
'replaced':replaced})
9 changes: 9 additions & 0 deletions ietf/idtracker/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,15 @@ class IDInternal(models.Model):
you cannot use draft__ as that will cause an INNER JOIN
which will limit the responses to I-Ds.
"""

ACTIVE=1
PUBLISHED=3
EXPIRED=2
WITHDRAWN_SUBMITTER=4
REPLACED=5
WITHDRAWN_IETF=6
INACTIVE_STATES=[99,32,42]

draft = models.ForeignKey(InternetDraft, primary_key=True, unique=True, db_column='id_document_tag')
rfc_flag = models.IntegerField(null=True)
ballot = models.ForeignKey(BallotInfo, related_name='drafts', db_column="ballot_id")
Expand Down
21 changes: 21 additions & 0 deletions ietf/templates/idindex/all_ids.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

Internet-Drafts Status Summary

Web version is available at
https://datatracker.ietf.org/public/idindex.cgi


{% for item in in_track_ids %}{{ item.filename }}-{{ item.revision_display }} {{ item.revision_date|default_if_none:"" }} In IESG processing - ID Tracker state <{{ item.idstate }}> {# that last tab is on purpose #}
{% endfor %}{#
#}{% for item in active %}{{ item.filename }}-{{ item.revision_display }} {{ item.revision_date|default_if_none:"" }} {{ item.status.status }} {# keep that last tab #}
{% endfor %}{#
#}{% for item in published %}{{ item.filename }}-{{ item.revision_display }} {{ item.revision_date|default_if_none:"" }} {{ item.status.status }} {{ item.rfc_number }}
{% endfor %}{#
#}{% for item in expired %}{{ item.filename }}-{{ item.revision_display }} {{ item.revision_date|default_if_none:"" }} {{ item.status.status }} {# keep that last tab #}
{% endfor %}{#
#}{% for item in withdrawn_submitter %}{{ item.filename }}-{{ item.revision_display }} {{ item.revision_date|default_if_none:"" }} {{ item.status.status }} {# keep that last tab #}
{% endfor %}{#
#}{% for item in withdrawn_ietf %}{{ item.filename }}-{{ item.revision_display }} {{ item.revision_date|default_if_none:"" }} {{ item.status.status }} {# keep that last tab #}
{% endfor %}{#
#}{% for item in replaced %}{{ item.filename }}-{{ item.revision_display }} {{ item.revision_date|default_if_none:"" }} {{ item.status.status }} replaced by {% if item.replaced_by_id %}{{ item.replaced_by.filename }}{% else %}0{% endif %} {# and this one needs the trailing tab as well #}
{% endfor %}

0 comments on commit e196187

Please sign in to comment.