diff --git a/oarepo_model_builder/invenio/invenio_record_resource_config.py b/oarepo_model_builder/invenio/invenio_record_resource_config.py index 3eed535..410e699 100644 --- a/oarepo_model_builder/invenio/invenio_record_resource_config.py +++ b/oarepo_model_builder/invenio/invenio_record_resource_config.py @@ -5,3 +5,7 @@ class InvenioRecordResourceConfigBuilder(InvenioBaseClassPythonBuilder): TYPE = "invenio_record_resource_config" section = "resource-config" template = "resource-config" + + def finish(self, **extra_kwargs): + profile = self.current_model.profile + super().finish(profile=profile, **extra_kwargs) \ No newline at end of file diff --git a/oarepo_model_builder/invenio/templates/resource_config.py.jinja2 b/oarepo_model_builder/invenio/templates/resource_config.py.jinja2 index 2aed982..3fbf827 100644 --- a/oarepo_model_builder/invenio/templates/resource_config.py.jinja2 +++ b/oarepo_model_builder/invenio/templates/resource_config.py.jinja2 @@ -1,8 +1,6 @@ import importlib_metadata from flask_resources import ResponseHandler -{{ vars.json_serializer.class|imports }} -{{ vars.resource_config|imports }} class {{ vars.resource_config|class_header }}: """{{ vars.record.class|base_name }} resource config.""" @@ -24,7 +22,7 @@ class {{ vars.resource_config|class_header }}: @property def error_handlers(self): entrypoint_error_handlers = {} - for x in importlib_metadata.entry_points(group='invenio.{{ vars.module.qualified }}.error_handlers'): + for x in importlib_metadata.entry_points(group='invenio.{{ vars.module.qualified }}_{{ profile }}.error_handlers'): entrypoint_error_handlers.update(x.load()) return { **super().error_handlers, diff --git a/setup.cfg b/setup.cfg index 230fd53..c0a9411 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = oarepo-model-builder -version = 4.0.101 +version = 4.0.102 description = A utility library that generates OARepo required data model files from a JSON specification file authors = Miroslav Bauer , Miroslav Simek readme = README.md diff --git a/tests/test_simple_builders.py b/tests/test_simple_builders.py index 0c53888..41cf5e3 100644 --- a/tests/test_simple_builders.py +++ b/tests/test_simple_builders.py @@ -324,7 +324,7 @@ def test_resource_config_builder(): [InvenioRecordResourceConfigBuilder], os.path.join("test", "resources", "records", "config.py"), ) - + print(data) assert strip_whitespaces(data) == strip_whitespaces( ''' import importlib_metadata