3636# IESGComment, IESGDiscuss, DocumentComment, idrfc.DraftVersions
3737
3838def name (name_class , slug , name , desc = "" ):
39- # create if it doesn't exist, set name
39+ # create if it doesn't exist, set name and desc
4040 obj , _ = name_class .objects .get_or_create (slug = slug )
4141 obj .name = name
4242 obj .desc = desc
@@ -147,7 +147,7 @@ def date_in_match(match):
147147
148148re_telechat_agenda = re .compile (r"(Placed on|Removed from) agenda for telechat - %s by" % date_re_str )
149149re_ballot_position = re .compile (r"\[Ballot Position Update\] (New position, (?P<position>.*), has been recorded (|for (?P<for>.*) )|Position (|for (?P<for2>.*) )has been changed to (?P<position2>.*) from .*)by (?P<by>.*)" )
150- re_ballot_issued = re .compile (r"Ballot has been issued by" )
150+ re_ballot_issued = re .compile (r"Ballot has been issued(| by) " )
151151re_state_changed = re .compile (r"(State (has been changed|changed|Changes) to <b>(?P<to>.*)</b> from <b>(?P<from>.*)</b> by|Sub state has been changed to (?P<tosub>.*) from (?P<fromsub>.*))" )
152152re_note_changed = re .compile (r"(\[Note\]: .*'.*'|Note field has been cleared)" )
153153re_draft_added = re .compile (r"Draft [Aa]dded (by .*)?( in state (?P<state>.*))?" )
@@ -158,7 +158,10 @@ def date_in_match(match):
158158re_responsible_ad_changed = re .compile (r"(Responsible AD|Shepherding AD) has been changed to (<b>)?" )
159159re_intended_status_changed = re .compile (r"Intended [sS]tatus has been changed to (<b>)?" )
160160re_state_change_notice = re .compile (r"State Change Notice email list (have been change|has been changed) (<b>)?" )
161-
161+
162+
163+ made_up_date = datetime .datetime (2030 , 1 , 1 , 0 , 0 , 0 )
164+
162165all_drafts = InternetDraft .objects .all ().select_related ()
163166if draft_name_to_import :
164167 all_drafts = all_drafts .filter (filename = draft_name_to_import )
@@ -209,7 +212,7 @@ def date_in_match(match):
209212 if match :
210213 e = Telechat ()
211214 e .type = "scheduled_for_telechat"
212- e .telechat_date = date_in_match (match )
215+ e .telechat_date = date_in_match (match ) if "Placed on" in c . comment_text else None
213216 # can't extract this from history so we just take the latest value
214217 e .returning_item = bool (o .idinternal .returning_item )
215218 save_event (d , e , c )
@@ -313,6 +316,12 @@ def date_in_match(match):
313316 save_event (d , e , c )
314317 handled = True
315318
319+ # document expiration
320+ if c .comment_text == "Document is expired by system" :
321+ e = Event (type = "expired_document" )
322+ save_event (d , e , c )
323+ handled = True
324+
316325 # approved document
317326 match = re_document_approved .search (c .comment_text )
318327 if match :
@@ -384,13 +393,15 @@ def date_in_match(match):
384393 if not handled :
385394 print "couldn't handle %s '%s'" % (c .id , c .comment_text .replace ("\n " , "" ).replace ("\r " , "" ))
386395
387- # import events that might be missing, we don't know where to
388- # place them but if we don't generate them, we'll be missing
389- # the information completely
396+
397+ # import events that might be missing, we can't be sure where
398+ # to place them but if we don't generate them, we'll be
399+ # missing the information completely
390400 e = d .latest_event (Status , type = "changed_status_date" )
391401 status_date = e .date if e else None
392402 if o .idinternal .status_date != status_date :
393403 e = Status (type = "changed_status_date" , date = o .idinternal .status_date )
404+ e .time = made_up_date
394405 e .by = system_email
395406 e .doc = d
396407 e .desc = "Status date has been changed to <b>%s</b> from <b>%s</b>" % (o .idinternal .status_date , status_date )
@@ -406,8 +417,40 @@ def date_in_match(match):
406417 e .desc = "IESG has approved"
407418 e .save ()
408419
409- # FIXME: import writeups
420+ if o .lc_expiration_date :
421+ e = Expiration (type = "sent_last_call" , expires = o .lc_expiration_date )
422+ e .time = o .lc_sent_date
423+ # let's try to figure out who did it
424+ events = d .event_set .filter (type = "changed_document" , desc__contains = " to <b>In Last Call</b>" ).order_by ('-time' )[:1 ]
425+ e .by = events [0 ].by if events else system_email
426+ e .doc = d
427+ e .desc = "Last call sent"
428+ e .save ()
410429
430+ if o .idinternal :
431+ e = d .latest_event (Telechat , type = "scheduled_for_telechat" )
432+ telechat_date = e .telechat_date if e else None
433+ if not o .idinternal .agenda :
434+ o .idinternal .telechat_date = None # normalize
435+
436+ if telechat_date != o .idinternal .telechat_date :
437+ e = Telechat (type = "scheduled_for_telechat" ,
438+ telechat_date = o .idinternal .telechat_date ,
439+ returning_item = bool (o .idinternal .returning_item ))
440+ e .time = made_up_date
441+ e .by = system_email
442+ args = ("Placed on" , o .idinternal .telechat_date ) if o .idinternal .telechat_date else ("Removed from" , telechat_date )
443+ e .doc = d
444+ e .desc = "%s agenda for telechat - %s by system" % args
445+ e .save ()
446+
447+ # FIXME: import writeups
448+
449+ # RFC alias
450+ if o .rfc_number :
451+ rfc_name = "rfc%s" % o .rfc_number
452+ DocAlias .objects .get_or_create (document = d , name = rfc_name )
453+
411454 # import missing revision changes from DraftVersions
412455 known_revisions = set (e .newrevision .rev for e in d .event_set .filter (type = "new_revision" ).select_related ('newrevision' ))
413456 for v in DraftVersions .objects .filter (filename = d .name ).order_by ("revision" ):
@@ -424,7 +467,7 @@ def date_in_match(match):
424467 e .save ()
425468 known_revisions .add (v .revision )
426469
427- print "imported" , d .name , "S: " , d .iesg_state
470+ print "imported" , d .name , " - " , d .iesg_state
428471
429472
430473
@@ -439,27 +482,27 @@ class CheckListInternetDraft(models.Model):
439482# group = models.ForeignKey(Acronym, db_column='group_acronym_id')
440483# filename = models.CharField(max_length=255, unique=True)
441484# revision = models.CharField(max_length=2)
442- revision_date = models .DateField ()
443- file_type = models .CharField (max_length = 20 )
485+ # revision_date = models.DateField()
486+ # file_type = models.CharField(max_length=20)
444487# txt_page_count = models.IntegerField()
445- local_path = models .CharField (max_length = 255 , blank = True , null = True )
446- start_date = models .DateField ()
447- expiration_date = models .DateField (null = True )
488+ # local_path = models.CharField(max_length=255, blank=True, null=True)
489+ # start_date = models.DateField()
490+ # expiration_date = models.DateField(null=True)
448491# abstract = models.TextField()
449- dunn_sent_date = models .DateField (null = True , blank = True )
450- extension_date = models .DateField (null = True , blank = True )
492+ # dunn_sent_date = models.DateField(null=True, blank=True)
493+ # extension_date = models.DateField(null=True, blank=True)
451494# status = models.ForeignKey(IDStatus)
452495# intended_status = models.ForeignKey(IDIntendedStatus)
453- lc_sent_date = models .DateField (null = True , blank = True )
454- lc_changes = models .CharField (max_length = 3 ,null = True )
455- lc_expiration_date = models .DateField (null = True , blank = True )
456- b_sent_date = models .DateField (null = True , blank = True )
457- b_discussion_date = models .DateField (null = True , blank = True )
496+ # lc_sent_date = models.DateField(null=True, blank=True)
497+ # lc_changes = models.CharField(max_length=3,null=True)
498+ # lc_expiration_date = models.DateField(null=True, blank=True)
499+ # b_sent_date = models.DateField(null=True, blank=True)
500+ # b_discussion_date = models.DateField(null=True, blank=True)
458501# b_approve_date = models.DateField(null=True, blank=True)
459- wgreturn_date = models .DateField (null = True , blank = True )
460- rfc_number = models .IntegerField (null = True , blank = True , db_index = True )
502+ # wgreturn_date = models.DateField(null=True, blank=True)
503+ # rfc_number = models.IntegerField(null=True, blank=True, db_index=True)
461504# comments = models.TextField(blank=True,null=True)
462- last_modified_date = models .DateField ()
505+ # last_modified_date = models.DateField()
463506 replaced_by = BrokenForeignKey ('self' , db_column = 'replaced_by' , blank = True , null = True , related_name = 'replaces_set' )
464507 replaces = FKAsOneToOne ('replaces' , reverse = True )
465508 review_by_rfc_editor = models .BooleanField ()
0 commit comments