Skip to content

Commit 2ae277e

Browse files
committed
Handle complex configs in the same place
Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent c2233f8 commit 2ae277e

File tree

1 file changed

+5
-23
lines changed

1 file changed

+5
-23
lines changed

src/saml2/config.py

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -258,21 +258,13 @@ def load_special(self, cnf, typ):
258258
self.setattr(typ, arg, _val)
259259

260260
self.context = typ
261-
self.load_complex(cnf, typ)
262261
self.context = self.def_context
263262

264-
def load_complex(self, cnf, typ=""):
265-
try:
266-
self.setattr(typ, "policy", Policy(cnf["policy"], config=self))
267-
except KeyError:
268-
pass
269-
270-
# for srv, spec in cnf["service"].items():
271-
# try:
272-
# self.setattr(srv, "policy",
273-
# Policy(cnf["service"][srv]["policy"]))
274-
# except KeyError:
275-
# pass
263+
def load_complex(self, cnf):
264+
acs = ac_factory(cnf.get("attribute_map_dir"))
265+
if not acs:
266+
raise ConfigurationError("No attribute converters, something is wrong!!")
267+
self.setattr("", "attribute_converters", acs)
276268

277269
def unicode_convert(self, item):
278270
try:
@@ -339,16 +331,6 @@ def load(self, cnf, metadata_construction=False):
339331
if "extensions" in cnf:
340332
self.do_extensions(cnf["extensions"])
341333

342-
acs = ac_factory(cnf.get("attribute_map_dir"))
343-
if not acs:
344-
raise ConfigurationError("No attribute converters, something is wrong!!")
345-
self.setattr("", "attribute_converters", acs)
346-
347-
try:
348-
self.setattr("", "metadata", self.load_metadata(cnf["metadata"]))
349-
except KeyError:
350-
pass
351-
352334
self.load_complex(cnf)
353335
self.context = self.def_context
354336

0 commit comments

Comments
 (0)