5454break_slot = name (TimeSlotTypeName , "break" , "Break" )
5555registration_slot = name (TimeSlotTypeName , "reg" , "Registration" )
5656plenary_slot = name (TimeSlotTypeName , "plenary" , "Plenary" )
57- other_slot = name (TimeSlotTypeName , "other" , "Other" )
5857
5958conflict_constraints = {
6059 1 : name (ConstraintName , "conflict" , "Conflicts with" ),
@@ -171,14 +170,54 @@ def parse_time_desc(o):
171170 "4" : 150 * 60 ,
172171 }
173172
174- def import_materials (wg_meeting_session , timeslot = None , session = None ):
175- if timeslot :
176- meeting = timeslot .meeting
177- materials = timeslot .materials
178- else :
179- meeting = session .meeting
180- materials = session .materials
173+ non_group_mapping = {
174+ "plenaryw" : "ietf" ,
175+ "plenaryt" : "ietf" ,
176+ "newcomer" : "edu" ,
177+ "editor" : "edu" ,
178+ "wgchair" : "edu" ,
179+ "sectut" : "edu" ,
180+ "protut" : "edu" ,
181+ "iepg" : "iepg" ,
182+ "rfc" : "edu" ,
183+ "wgleader" : "edu" ,
184+ "xml2rfc" : "edu" ,
185+ "rbst" : "edu" ,
186+ "recp" : "ietf" ,
187+ "MIBDOC" : "edu" ,
188+ "IE" : "iepg" ,
189+ "newcomF" : "edu" ,
190+ "WritRFC" : "edu" ,
191+ "Orien" : "edu" ,
192+ "newwork" : "edu" ,
193+ "leadership" : "edu" ,
194+ "ipv6spec" : "edu" ,
195+ "Wel" : "ietf" ,
196+ "IDRTut" : "edu" ,
197+ "ToolsTut" : "edu" ,
198+ "cosp" : "tools" ,
199+ "doclife" : "edu" ,
200+ "dnstut" : "edu" ,
201+ "xmltut" : "edu" ,
202+ "RFCEd" : "edu" ,
203+ "IDRBasics" : "edu" ,
204+ "newcomSWED" : "edu" ,
205+ "MIBTut" : "edu" ,
206+ "IDR75" : "edu" ,
207+ "NewcomerJP" : "edu" ,
208+ "MIBT" : "edu" ,
209+ "DNSProg" : "edu" ,
210+ "natTUT" : "edu" ,
211+ "NewcomerCHINA" : "edu" ,
212+ "CreatingID" : "edu" ,
213+ "NewMeetGreet" : "ietf" ,
214+ "appsprepmeeting" : "edu" ,
215+ "NewcomersFrench" : "edu" ,
216+ "NewComMandar" : "edu" ,
217+ "AdminP" : "ietf" ,
218+ }
181219
220+ def import_materials (wg_meeting_session , session ):
182221 def import_material_kind (kind , doctype ):
183222 # import agendas
184223 irtf = 0
@@ -190,44 +229,39 @@ def import_material_kind(kind, doctype):
190229 interim = 0 )
191230
192231 for o in found :
193- if session :
194- acronym = session .group .acronym
195- else :
196- acronym = wg_meeting_session .acronym ()
197- name = "%s-%s-%s" % (doctype .slug , meeting .number , acronym )
232+ name = "%s-%s-%s" % (doctype .slug , session .meeting .number , acronym )
198233 if kind == Slide :
199234 name += "-%s" % o .slide_num
200235
236+ if session .name :
237+ name += "-%s" % slugify (session .name )
238+
201239 name = name .lower ()
202240
203241 try :
204242 d = Document .objects .get (type = doctype , docalias__name = name )
205243 except Document .DoesNotExist :
206244 d = Document (type = doctype , name = name )
207245
208- if session :
209- session_name = session .group .acronym .upper ()
210- else :
211- session_name = timeslot .name
212-
213246 if kind == Slide :
214247 d .title = o .slide_name .strip ()
215248 l = o .file_loc ()
216249 d .external_url = l [l .find ("slides/" ) + len ("slides/" ):]
217250 d .order = o .order_num or 1
218251 else :
219- d .title = u"%s for %s at %s" % (doctype .name , session_name , meeting )
252+ session_name = session .name if session .name else session .group .acronym .upper ()
253+ d .title = u"%s for %s at %s" % (doctype .name , session_name , session .meeting )
220254 d .external_url = o .filename # save filenames for now as they don't appear to be quite regular
221255 d .rev = "01"
222- d .group = session .group if session else None
256+ d .group = session .group
223257
224258 d .save ()
225259
226260 d .set_state (State .objects .get (type = doctype , slug = "active" ))
227261
228262 DocAlias .objects .get_or_create (document = d , name = name )
229263
230- materials .add (d )
264+ session . materials .add (d )
231265
232266 # try to create a doc event to figure out who uploaded it
233267 t = d .type_id
@@ -258,6 +292,8 @@ def import_material_kind(kind, doctype):
258292 import_material_kind (Minute , minutes_doctype )
259293 import_material_kind (Slide , slides_doctype )
260294
295+ obviously_bogus_date = datetime .date (1970 , 1 , 1 )
296+
261297for o in WgMeetingSession .objects .all ().order_by ("pk" ).iterator ():
262298 # num_session is unfortunately not quite reliable, seems to be
263299 # right for 1 or 2 but not 3 and it's sometimes null
@@ -302,30 +338,22 @@ def get_timeslot(attr):
302338 acronym = Acronym .objects .get (pk = o .group_acronym_id )
303339 if o .group_acronym_id < 0 :
304340 # this wasn't actually a WG session, but rather a tutorial
305- # or similar, don't create a session but instead modify
306- # the time slot appropriately
307- if not timeslot :
308- print "IGNORING unscheduled non-WG-session" , acronym .name
309- continue
310-
311- meeting_time = getattr (o , "sched_time_id%s" % i )
312- if meeting_time .session_name_id :
313- timeslot .name = meeting_time .session_name .session_name
314- else :
315- timeslot .name = acronym .name
316-
317- if "Plenary" in timeslot .name :
318- timeslot .type = plenary_slot
319- else :
320- timeslot .type = other_slot
321- timeslot .modified = o .last_modified_date
322- timeslot .save ()
323-
324- import_materials (o , timeslot = timeslot )
325-
326- continue
327-
328- s .group = Group .objects .get (acronym = acronym .acronym )
341+ # or similar
342+ a = non_group_mapping .get (acronym .acronym )
343+ if not a :
344+ a = "ietf"
345+ print "UNKNOWN phony group" , o .group_acronym_id , acronym .acronym , "falling back to '%s'" % a
346+ s .group = Group .objects .get (acronym = a )
347+ s .name = acronym .name
348+
349+ if timeslot :
350+ if timeslot .name == "Unknown" :
351+ timeslot .name = acronym .name
352+
353+ if "Plenary" in timeslot .name :
354+ timeslot .type = plenary_slot
355+ else :
356+ s .group = Group .objects .get (acronym = acronym .acronym )
329357 s .attendees = o .number_attendee
330358 s .agenda_note = (o .special_agenda_note or "" ).strip ()
331359 s .requested = o .requested_date or obviously_bogus_date
@@ -340,7 +368,7 @@ def get_timeslot(attr):
340368 s .status = session_status_mapping [o .status_id or 5 ]
341369
342370 s .scheduled = o .scheduled_date
343- s .modified = o .last_modified_date
371+ s .modified = o .last_modified_date or obviously_bogus_date
344372
345373 s .save ()
346374
@@ -349,7 +377,7 @@ def get_timeslot(attr):
349377 timeslot .modified = s .modified
350378 timeslot .save ()
351379
352- import_materials (o , timeslot = timeslot , session = s )
380+ import_materials (o , s )
353381
354382 # some sessions have been scheduled over multiple time slots
355383 if i < 3 :
@@ -358,7 +386,6 @@ def get_timeslot(attr):
358386 timeslot .session = s
359387 timeslot .modified = s .modified
360388 timeslot .save ()
361- import_materials (o , timeslot = timeslot , session = s )
362389
363390
364391 for i in (1 , 2 , 3 ):
0 commit comments