Skip to content

Commit 6b7e037

Browse files
author
Roland Hedberg
committed
Allow config file specification to be whole path and not just a module/file name.
1 parent 812e1e7 commit 6b7e037

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/saml2/config.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,17 @@ def load(self, cnf, metadata_construction=False):
312312
return self
313313

314314
def load_file(self, config_file, metadata_construction=False):
315-
if sys.path[0] != ".":
316-
sys.path.insert(0, ".")
317-
318315
if config_file.endswith(".py"):
319316
config_file = config_file[:-3]
320317

321-
mod = import_module(config_file)
318+
head, tail = os.path.split(config_file)
319+
if head == "":
320+
if sys.path[0] != ".":
321+
sys.path.insert(0, ".")
322+
else:
323+
sys.path.insert(0, head)
324+
325+
mod = import_module(tail)
322326
#return self.load(eval(open(config_file).read()))
323327
return self.load(mod.CONFIG, metadata_construction)
324328

0 commit comments

Comments
 (0)