Skip to content

Commit

Permalink
#89 - Methods exposing a simple way to execute plugin methods in corr…
Browse files Browse the repository at this point in the history
…ect order
  • Loading branch information
dotchetter committed Jan 7, 2024
1 parent 6e24c74 commit bd947a9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pyttman/core/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,17 @@ def abilities(self, abilities):
for ability in abilities:
setattr(self, ability.__class__.__name__, ability)
self._abilities.add(ability)

def execute_plugins_before_start(self):
try:
for plugin in self.plugins:
self.loaded_plugins.ingest(plugin)
plugin.before_app_start(self)
except Exception as e:
raise PyttmanPluginException(
f"The plugin '{plugin.__class__.__name__}' "
f"caused the boostrap to fail.") from e

def execute_plugins_after_stop(self):
for plugin in self.plugins:
plugin.after_app_stops(self)

0 comments on commit bd947a9

Please sign in to comment.