4646bodies = {
4747 'IESG' : Group .objects .get (acronym = "iesg" ),
4848 'IETF' : Group .objects .get (acronym = "ietf" ),
49+ 'IETF IESG' : Group .objects .get (acronym = "iesg" ),
50+ 'The IETF' : Group .objects .get (acronym = "ietf" ),
4951 'IAB/ISOC' : Group .objects .get (acronym = "iab" ),
52+ 'ISOC/IAB' : Group .objects .get (acronym = "iab" ),
5053 'IAB/IESG' : Group .objects .get (acronym = "iab" ),
5154 'IAB' : Group .objects .get (acronym = "iab" ),
55+ 'IETF IAB' : Group .objects .get (acronym = "iab" ),
5256 'IETF Transport Directorate' : Group .objects .get (acronym = "tsvdir" ),
5357 'Sigtran' : Group .objects .get (acronym = "sigtran" , type = "wg" ),
5458 'IETF RAI WG' : Group .objects .get (acronym = "rai" , type = "area" ),
59+ 'IETF RAI' : Group .objects .get (acronym = "rai" , type = "area" ),
5560 'IETF Mobile IP WG' : Group .objects .get (acronym = "mobileip" , type = "wg" ),
61+ "IETF Operations and Management Area" : Group .objects .get (acronym = "ops" , type = "area" ),
62+ "IETF/Operations and Management Area" : Group .objects .get (acronym = "ops" , type = "area" ),
63+ "IETF OAM Area" : Group .objects .get (acronym = "ops" , type = "area" ),
64+ "IETF O&M Area" : Group .objects .get (acronym = "ops" , type = "area" ),
65+ "IETF O&M area" : Group .objects .get (acronym = "ops" , type = "area" ),
66+ "IETF O&M" : Group .objects .get (acronym = "ops" , type = "area" ),
67+ "IETF O&M Area Directors" : Group .objects .get (acronym = "ops" , type = "area" ),
68+ "PWE3 Working Greoup" : Group .objects .get (acronym = "pwe3" , type = "wg" ),
69+ "IETF PWE 3 WG" : Group .objects .get (acronym = "pwe3" , type = "wg" ),
70+ "IETF/Routing Area" : Group .objects .get (acronym = "rtg" , type = "area" ),
71+ "IRTF Internet Area" : Group .objects .get (acronym = "int" , type = "area" ),
72+ "IETF Sub IP Area" : Group .objects .get (acronym = "sub" , type = "area" ),
5673 }
5774
58- def get_from_body (name ):
75+ def get_body (name , raw_code ):
76+ if raw_code :
77+ # new tool is storing some group info directly, try decoding it
78+ b = None
79+ t = raw_code .split ("_" )
80+ if len (t ) == 2 :
81+ if t [0 ] == "area" :
82+ b = lookup_group (acronym = Acronym .objects .get (pk = t [1 ]), type = "area" )
83+ elif t [0 ] == "group" :
84+ b = lookup_group (acronym = Acronym .objects .get (pk = t [1 ]), type = "wg" )
85+
86+ if not b :
87+ b = lookup_group (acronym = raw_code )
88+
89+ return b
90+
5991 # the from body name is a nice case study in how inconsistencies
6092 # build up over time
93+ name = (name .replace ("(" , "" ).replace (")" , "" ).replace (" Chairs" , "" )
94+ .replace ("Working Group" , "WG" ).replace ("working group" , "WG" ))
6195 b = bodies .get (name )
6296 t = name .split ()
6397 if not b and name .startswith ("IETF" ):
64- if len (t ) < 3 or t [2 ].lower () == "wg" :
98+ if len (t ) == 1 :
99+ if "-" in name :
100+ t = name .split ("-" )
101+ elif "/" in name :
102+ t = name .split ("/" )
103+ b = lookup_group (acronym = t [1 ].lower (), type = "wg" )
104+ elif len (t ) < 3 or t [2 ].lower () == "wg" :
65105 b = lookup_group (acronym = t [1 ].lower (), type = "wg" )
66106 elif t [2 ].lower () in ("area" , "ad" ):
67- print "inside AREA"
68107 b = lookup_group (acronym = t [1 ].lower (), type = "area" )
69108 if not b :
70109 b = lookup_group (name = u"%s %s" % (t [1 ], t [2 ]), type = "area" )
@@ -77,7 +116,7 @@ def get_from_body(name):
77116
78117 return b
79118
80- for o in LiaisonDetail .objects .all ().order_by ("pk" ):#[:10]:
119+ for o in LiaisonDetail .objects .all ().order_by ("pk" ):
81120 print "importing LiaisonDetail" , o .pk
82121
83122 try :
@@ -100,12 +139,17 @@ def lookup_group(**kwargs):
100139 except Group .DoesNotExist :
101140 return None
102141
103- l .from_name = o .from_body ()
104- l .from_body = get_from_body (l .from_name ) # try to establish link
105- continue
106-
107- l .to_body = o .to_raw_body
108- l .to_name = o .to_raw_body
142+ l .from_name = o .from_body ().strip ()
143+ l .from_body = get_body (l .from_name , o .from_raw_code ) # try to establish link
144+
145+ if o .by_secretariat :
146+ l .to_name = o .submitter_name
147+ if o .submitter_email :
148+ l .to_name += " " + o .submitter_email
149+ else :
150+ l .to_name = o .to_body
151+ l .to_name = l .to_name .strip ()
152+ l .to_body = get_body (l .to_name , o .to_raw_code ) # try to establish link
109153 l .to_contact = (o .to_poc or "" ).strip ()
110154
111155 l .reply_to = (o .replyto or "" ).strip ()
@@ -115,7 +159,7 @@ def lookup_group(**kwargs):
115159 l .cc = (o .cc1 or "" ).strip ()
116160
117161 l .submitted = o .submitted_date
118- l .submitted_by = old_person_to_person (o .person )
162+ l .submitted_by = old_person_to_person (o .person ) if o . person else system_person
119163 l .modified = o .last_modified_date
120164 l .approved = o .approval and o .approval .approved and (o .approval .approval_date or l .modified or datetime .datetime .now ())
121165
0 commit comments