Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit b3b7e92

Browse files
authored
Merge pull request #10 from peppelinux/pplnx
abstorage with a lazy init for globally defined ORM paramenters
2 parents e365122 + c88827f commit b3b7e92

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/oidcmsg/storage/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
import logging
12
from .utils import importer
23

4+
logger = logging.getLogger(__name__)
5+
36

47
class AbstractStorage(object):
58
"""
@@ -11,7 +14,12 @@ def __init__(self, conf_dict):
1114
if isinstance(conf_dict['handler'], str):
1215
_handler = importer(conf_dict['handler'])
1316
_args = {k: v for k, v in conf_dict.items() if k != 'handler'}
14-
self.storage = _handler(_args)
17+
try:
18+
self.storage = _handler(_args)
19+
except TypeError as e:
20+
# needed for globally configured ORM models
21+
logger.debug('Abstorage {}: {}'.format(_handler, e))
22+
self.storage = _handler()
1523
else:
1624
self.storage = conf_dict['handler'](conf_dict)
1725

0 commit comments

Comments
 (0)