61
61
"referred_binding" ,
62
62
"session_storage" ,
63
63
"entity_category" ,
64
- "xmlsec_path"
64
+ "xmlsec_path" ,
65
+ "extension_schemas"
65
66
]
66
67
67
68
SP_ARGS = [
@@ -197,6 +198,7 @@ def __init__(self, homedir="."):
197
198
self .crypto_backend = 'xmlsec1'
198
199
self .scope = ""
199
200
self .allow_unknown_attributes = False
201
+ self .extension_schema = {}
200
202
201
203
def setattr (self , context , attr , val ):
202
204
if context == "" :
@@ -291,6 +293,11 @@ def load(self, cnf, metadata_construction=False):
291
293
for key , val in cnf ["virtual_organization" ].items ():
292
294
self .vorg [key ] = VirtualOrg (None , key , val )
293
295
continue
296
+ elif arg == "extension_schemas" :
297
+ # List of filename of modules representing the schemas
298
+ for mod_file in cnf ["extension_schemas" ]:
299
+ _mod = self ._load (mod_file )
300
+ self .extension_schema [_mod .NAMESPACE ] = _mod
294
301
295
302
try :
296
303
setattr (self , arg , _uc (cnf [arg ]))
@@ -314,18 +321,21 @@ def load(self, cnf, metadata_construction=False):
314
321
315
322
return self
316
323
317
- def load_file (self , config_file , metadata_construction = False ):
318
- if config_file .endswith (".py" ):
319
- config_file = config_file [:- 3 ]
320
-
321
- head , tail = os .path .split (config_file )
324
+ def _load (self , fil ):
325
+ head , tail = os .path .split (fil )
322
326
if head == "" :
323
327
if sys .path [0 ] != "." :
324
328
sys .path .insert (0 , "." )
325
329
else :
326
330
sys .path .insert (0 , head )
327
331
328
- mod = import_module (tail )
332
+ return import_module (tail )
333
+
334
+ def load_file (self , config_file , metadata_construction = False ):
335
+ if config_file .endswith (".py" ):
336
+ config_file = config_file [:- 3 ]
337
+
338
+ mod = self ._load (config_file )
329
339
#return self.load(eval(open(config_file).read()))
330
340
return self .load (mod .CONFIG , metadata_construction )
331
341
0 commit comments