Skip to content

Commit

Permalink
Changed Fhir.resources to allow inclusion of custom resources
Browse files Browse the repository at this point in the history
  • Loading branch information
zensoup committed Jan 5, 2019
1 parent a33b512 commit dbde90f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions fhirbug/Fhir/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import inspect

from fhirbug.Fhir import resources
from fhirbug.config import settings

dir = os.path.dirname(__file__)
for module_file in os.listdir(os.path.join(dir, 'Resources')):
Expand All @@ -18,8 +19,15 @@
for cls_name, cls in clsmembers:
setattr(resources, cls_name, cls)

# Import extensions
ext_module = importlib.import_module('fhirbug.Fhir.Resources.extensions')
clsmembers = inspect.getmembers(ext_module, inspect.isclass)
# Import internal extensions
int_module = importlib.import_module('fhirbug.Fhir.Resources.extensions')
clsmembers = inspect.getmembers(int_module, inspect.isclass)
for cls_name, cls in clsmembers:
setattr(resources, cls_name, cls)

# Import external extensions
if hasattr(settings, 'EXTENSIONS_PATH'):
ext_module = importlib.import_module(settings.EXTENSIONS_PATH)
clsmembers = inspect.getmembers(ext_module, inspect.isclass)
for cls_name, cls in clsmembers:
setattr(resources, cls_name, cls)

0 comments on commit dbde90f

Please sign in to comment.