From e196187a39e24815ae53a9ae62e27d13046f5343 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Sat, 21 Mar 2009 23:18:54 +0000 Subject: [PATCH] Merged in Roberts django-based replacement for the old perl script generating all_id.txt - Legacy-Id: 1398 --- ietf/bin/generate-allid-txt | 33 ++++++++++++++++++++++++++++++ ietf/idtracker/models.py | 9 ++++++++ ietf/templates/idindex/all_ids.txt | 21 +++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 ietf/bin/generate-allid-txt create mode 100644 ietf/templates/idindex/all_ids.txt diff --git a/ietf/bin/generate-allid-txt b/ietf/bin/generate-allid-txt new file mode 100644 index 000000000..456feca7c --- /dev/null +++ b/ietf/bin/generate-allid-txt @@ -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}) diff --git a/ietf/idtracker/models.py b/ietf/idtracker/models.py index d79eb4981..c233bbf75 100644 --- a/ietf/idtracker/models.py +++ b/ietf/idtracker/models.py @@ -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") diff --git a/ietf/templates/idindex/all_ids.txt b/ietf/templates/idindex/all_ids.txt new file mode 100644 index 000000000..29c4cf0ff --- /dev/null +++ b/ietf/templates/idindex/all_ids.txt @@ -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 %}