From c5ee2fc8b7f172a97c121dfcb45ac5634f245f35 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Sat, 16 Jul 2022 22:34:23 -0400 Subject: [PATCH] Updated decorator_notify (markdown) --- decorator_notify.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/decorator_notify.md b/decorator_notify.md index ea7550d..cb993ce 100644 --- a/decorator_notify.md +++ b/decorator_notify.md @@ -17,7 +17,7 @@ The advantage of having your own custom hook is that you can now extend Apprise 1. Trigger your own custom notification service 1. Anything you want can be mapped to it's own `schema://` that you define. -## The Notification Decorator +## Declaration: The Notification Decorator The `@notify` decorator is the key to linking everything together. Below is a very simple example of what your `hook.py` might look like: ```python # include the decorator @@ -161,14 +161,16 @@ The above would apply their initialization values on top of the declaration alre You can see that fields that were not changed keep the value passed from the declaration (ie.: the port). This allows you to prepare all of your configuration for your wrapper during it's declaration while still allowing the calling user to adjust values if required. ## Plugin Loading -Apprise will only load functions wrapped with `@notify()`. These must be placed in a `.py`. The loading process works as follows: -1. If you provide an absolute path to a `.py` file, then it is simply loaded (hidden or not). +Apprise will only load functions wrapped with `@notify()` decorator. These functions must exist in Python files (denoted with a `.py` extension). The loading process works as follows: +1. If you provide an absolute path to a `.py` file, then it is simply loaded (hidden file or not). 1. If you provide an absolute path to a directory, then one of 2 things can happen: 1. if an `__init__.py` file is found in this specified directory, then it is loaded and further processing stops. - 1. if no `__init__.py` file is found in the specified directory, then all `.py` files are loaded. - - if a directory is found, then one additional check is made for `directory/__init__.py`. If that is found, then that specifically is loaded (there is no recursive loading). In all other circumstances, the directory is skipped and moved on. + 1. if no `__init__.py` file is found in the specified directory, then all `.py` files located within this directory are loaded. + - if a directory is found, then a check is made to see if `directory/__init__.py` exists. + - If yes: then just that specific file is loaded. There is no further recursive loading/scanning from within this sub-directories. + - If no: then the directory is skipped. - While scanning a specified directory for all modules (due to not finding an `__init__.py` in the the path specified, all hidden files (prefixed with a period (`.`) are ignored. + All hidden files (prefixed with a period (`.`) are when this directory scanning is occurring. ## Command Line References