Skip to content

Commit

Permalink
Drop depcrecated app.schedulers and app.reporters attributes
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
  • Loading branch information
nhoening committed Jun 17, 2024
1 parent aeafc9e commit defcac6
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 15 deletions.
1 change: 1 addition & 0 deletions documentation/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Infrastructure / Support
* ``flexmeasures show beliefs`` uses the entity path (`<Account>/../<Sensor>`) in case of duplicated sensors [see `PR #1026 <https://github.com/FlexMeasures/flexmeasures/pull/1026/>`_]
* Add ``--resolution`` option to ``flexmeasures show chart`` to produce charts in different time resolutions [see `PR #1007 <https://github.com/FlexMeasures/flexmeasures/pull/1007/>`_]
* Add ``FLEXMEASURES_JSON_COMPACT`` config setting and deprecate ``JSONIFY_PRETTYPRINT_REGULAR`` setting [see `PR #1090 <https://github.com/FlexMeasures/flexmeasures/pull/1090/>`_]
* Removed depectrated ``app.schedulers`` and ``app.forecasters`` (use ``app.data_generators["scheduler"]`` and ``app.data_generators["forecaster"]`` instead) [see `PR #1098 <https://github.com/FlexMeasures/flexmeasures/pull/1098/>`_]


v0.21.0 | May 16, 2024
Expand Down
12 changes: 0 additions & 12 deletions flexmeasures/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,6 @@ def create( # noqa C901
) # use copy to avoid mutating app.reporters
app.data_generators["scheduler"] = schedulers

# deprecated: app.reporters and app.schedulers
app.reporters = reporters
app.schedulers = schedulers

def get_reporters():
app.logger.warning(
'`app.reporters` is deprecated. Use `app.data_generators["reporter"]` instead.'
)
return app.data_generators["reporter"]

setattr(app, "reporters", get_reporters())

# add auth policy

from flexmeasures.auth import register_at as register_auth_at
Expand Down
3 changes: 0 additions & 3 deletions flexmeasures/utils/plugin_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,10 @@ def register_plugins(app: Flask): # noqa: C901
plugin_schedulers = get_classes_module(module.__name__, Scheduler)

# add DataGenerators
# for legacy, we still maintain app.reporters and app.schedulers
if plugin_reporters:
app.data_generators["reporter"].update(plugin_reporters)
app.reporters.update(plugin_reporters)
if plugin_schedulers:
app.data_generators["scheduler"].update(plugin_schedulers)
app.schedulers.update(plugin_schedulers)

app.config["LOADED_PLUGINS"][plugin_name] = plugin_version
app.logger.info(f"Loaded plugins: {app.config['LOADED_PLUGINS']}")
Expand Down

0 comments on commit defcac6

Please sign in to comment.