133133AA_ARGS = ["attribute" , "attribute_profile" ]
134134
135135COMPLEX_ARGS = ["attribute_converters" , "metadata" , "policy" ]
136- ALL = set (COMMON_ARGS + SP_ARGS + AA_IDP_ARGS + PDP_ARGS + COMPLEX_ARGS +
137- AA_ARGS )
136+ ALL = set (COMMON_ARGS + SP_ARGS + AA_IDP_ARGS + PDP_ARGS + COMPLEX_ARGS + AA_ARGS )
138137
139138SPEC = {
140- "" : COMMON_ARGS + COMPLEX_ARGS ,
141- "sp" : COMMON_ARGS + COMPLEX_ARGS + SP_ARGS ,
139+ "" : COMMON_ARGS + COMPLEX_ARGS ,
140+ "sp" : COMMON_ARGS + COMPLEX_ARGS + SP_ARGS ,
142141 "idp" : COMMON_ARGS + COMPLEX_ARGS + AA_IDP_ARGS ,
143- "aa" : COMMON_ARGS + COMPLEX_ARGS + AA_IDP_ARGS + AA_ARGS ,
142+ "aa" : COMMON_ARGS + COMPLEX_ARGS + AA_IDP_ARGS + AA_ARGS ,
144143 "pdp" : COMMON_ARGS + COMPLEX_ARGS + PDP_ARGS ,
145- "aq" : COMMON_ARGS + COMPLEX_ARGS + AQ_ARGS ,
144+ "aq" : COMMON_ARGS + COMPLEX_ARGS + AQ_ARGS ,
146145}
147146
148147_RPA = [BINDING_HTTP_REDIRECT , BINDING_HTTP_POST , BINDING_HTTP_ARTIFACT ]
149148_PRA = [BINDING_HTTP_POST , BINDING_HTTP_REDIRECT , BINDING_HTTP_ARTIFACT ]
150- _SRPA = [BINDING_SOAP , BINDING_HTTP_REDIRECT , BINDING_HTTP_POST ,
151- BINDING_HTTP_ARTIFACT ]
149+ _SRPA = [BINDING_SOAP , BINDING_HTTP_REDIRECT , BINDING_HTTP_POST , BINDING_HTTP_ARTIFACT ]
152150
153151PREFERRED_BINDING = {
154152 "single_logout_service" : _SRPA ,
@@ -251,7 +249,7 @@ def getattr(self, attr, context=None):
251249 else :
252250 return getattr (self , "_%s_%s" % (context , attr ), None )
253251
254- def load_special (self , cnf , typ , metadata_construction = False ):
252+ def load_special (self , cnf , typ ):
255253 for arg in SPEC [typ ]:
256254 try :
257255 _val = cnf [arg ]
@@ -265,10 +263,10 @@ def load_special(self, cnf, typ, metadata_construction=False):
265263 self .setattr (typ , arg , _val )
266264
267265 self .context = typ
268- self .load_complex (cnf , typ , metadata_construction = metadata_construction )
266+ self .load_complex (cnf , typ )
269267 self .context = self .def_context
270268
271- def load_complex (self , cnf , typ = "" , metadata_construction = False ):
269+ def load_complex (self , cnf , typ = "" ):
272270 try :
273271 self .setattr (typ , "policy" , Policy (cnf ["policy" ], config = self ))
274272 except KeyError :
@@ -281,32 +279,6 @@ def load_complex(self, cnf, typ="", metadata_construction=False):
281279 # except KeyError:
282280 # pass
283281
284- try :
285- try :
286- acs = ac_factory (cnf ["attribute_map_dir" ])
287- except KeyError :
288- acs = ac_factory ()
289-
290- if not acs :
291- raise ConfigurationError (
292- "No attribute converters, something is wrong!!" )
293-
294- _acs = self .getattr ("attribute_converters" , typ )
295- if _acs :
296- _acs .extend (acs )
297- else :
298- self .setattr (typ , "attribute_converters" , acs )
299-
300- except KeyError :
301- pass
302-
303- if not metadata_construction :
304- try :
305- self .setattr (typ , "metadata" ,
306- self .load_metadata (cnf ["metadata" ]))
307- except KeyError :
308- pass
309-
310282 def unicode_convert (self , item ):
311283 try :
312284 return six .text_type (item , "utf-8" )
@@ -364,17 +336,25 @@ def load(self, cnf, metadata_construction=False):
364336 if "service" in cnf :
365337 for typ in ["aa" , "idp" , "sp" , "pdp" , "aq" ]:
366338 try :
367- self .load_special (
368- cnf ["service" ][typ ], typ ,
369- metadata_construction = metadata_construction )
339+ self .load_special (cnf ["service" ][typ ], typ )
370340 self .serves .append (typ )
371341 except KeyError :
372342 pass
373343
374344 if "extensions" in cnf :
375345 self .do_extensions (cnf ["extensions" ])
376346
377- self .load_complex (cnf , metadata_construction = metadata_construction )
347+ acs = ac_factory (cnf .get ("attribute_map_dir" ))
348+ if not acs :
349+ raise ConfigurationError ("No attribute converters, something is wrong!!" )
350+ self .setattr ("" , "attribute_converters" , acs )
351+
352+ try :
353+ self .setattr ("" , "metadata" , self .load_metadata (cnf ["metadata" ]))
354+ except KeyError :
355+ pass
356+
357+ self .load_complex (cnf )
378358 self .context = self .def_context
379359
380360 return self
@@ -400,10 +380,8 @@ def load_metadata(self, metadata_conf):
400380 """ Loads metadata into an internal structure """
401381
402382 acs = self .attribute_converters
403-
404383 if acs is None :
405- raise ConfigurationError (
406- "Missing attribute converter specification" )
384+ raise ConfigurationError ("Missing attribute converter specification" )
407385
408386 try :
409387 ca_certs = self .ca_certs
0 commit comments