Skip to content

Commit 2dc118c

Browse files
committed
Handle some broken entries
- Legacy-Id: 3866
1 parent 65e5298 commit 2dc118c

1 file changed

Lines changed: 23 additions & 4 deletions

File tree

redesign/importing/import-docs.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,8 @@ def import_from_idinternal(d, idinternal):
788788
d.title = o.title
789789
d.group = Group.objects.get(acronym=o.group.acronym)
790790

791+
d.states = []
792+
791793
d.set_state(state_mapping[o.status.status])
792794

793795
# try guess stream to have a default for old submissions
@@ -805,21 +807,38 @@ def import_from_idinternal(d, idinternal):
805807
if sid and sid[0].stream:
806808
d.stream = stream_mapping[sid[0].stream.name]
807809

808-
d.unset_state("draft-iesg")
809810
try:
810811
s = StateOld.objects.get(stateobjectrelation__content_type=old_internetdraft_content_type_id,
811812
stateobjectrelation__content_id=o.pk)
812813
except StateOld.DoesNotExist:
813814
s = None
814815

815-
if s and not (s.name == "WG Document" and d.group.type_id == "individ"):
816+
if s:
816817
try:
817818
# there may be a mismatch between the stream type and the
818819
# state because of a bug in the ietfworkflows code so try
819820
# first without type constraint
820-
d.set_state(State.objects.get(name=s.name))
821+
new_s = State.objects.get(name=s.name)
821822
except State.MultipleObjectsReturned:
822-
d.set_state(State.objects.get(type="draft-stream-%s" % d.stream_id, name=s.name))
823+
new_s = State.objects.get(type="draft-stream-%s" % d.stream_id, name=s.name)
824+
825+
# fix some bugs in the old data
826+
if s.name == "WG Document" and d.group.type_id == "individ":
827+
skip = True
828+
829+
if d.name.startswith("draft-ietf"):
830+
if d.name not in ("draft-ietf-proto-wgchair-tracker-ext", "draft-ietf-proto-iab-irtf-tracker-ext", "draft-ietf-sipping-nat-scenarios", "draft-ietf-sipping-sip-offeranswer"):
831+
skip = False
832+
833+
group_acronym = d.name.split("-")[2]
834+
if group_acronym == "pppext":
835+
group_acronym = "trill"
836+
837+
d.group = Group.objects.get(acronym=group_acronym)
838+
839+
if not skip:
840+
d.set_state(new_s)
841+
823842

824843
# there was a bug in ietfworkflows so the group wasn't set on adopted documents
825844
if s.name in ("Call for Adoption by WG Issued", "Adopted by a WG") and d.group.type_id == "individ" and o.replaced_by and o.replaced_by.group:

0 commit comments

Comments
 (0)