ObjNotifyEdit extends ObjNotify to provide YAML export/import for
notification channel definitions. It exports all def_notify rows for a
given package so notification configs can be ported between environments.
Exported files are written to local.documents/notify/ by default.
ObjNotify.ObjNotify
→ ObjNotifyEdit.ObjNotifyEdit ← this module
| Table | Purpose |
|---|---|
def_notify |
One row per NotifyCode/Package — channel routing config |
Package is stripped from each row since it is stored at the top level.
package: homechoice
notifications:
- NotifyCode: SYSADMIN
NotifySlackSend: Y
NotifySlackConnection: homechoice
NotifySmsSend: N
Usergroups: SYSADMIN
- NotifyCode: BILLING_ALERT
NotifySlackSend: Y
NotifyEmailSend: Y
NotifyEmailConnection: smtp_primary
Usergroups: BILLING
import_from_data() issues a single DELETE … WHERE Package = ? to replace
all notifications for the package, then reinserts each row from the file.
# Export all notifications for the active package
python factory.core/extend.edit/ObjNotifyEdit.py save
# Export for a specific package
python factory.core/extend.edit/ObjNotifyEdit.py save --package homechoice
# Custom output filename
python factory.core/extend.edit/ObjNotifyEdit.py save \
--filename prod_notify.yaml
# Import from YAML file
python factory.core/extend.edit/ObjNotifyEdit.py load notify_homechoice.yaml
# List all notifications
python factory.core/extend.edit/ObjNotifyEdit.py list-notifications
| Method | Purpose |
|---|---|
load(package) |
Load all notification rows from DB |
list_notifications(package) |
List codes with channel flags |
export_to_file(filename, package) |
Export to YAML |
import_from_data(data, package) |
Import from in-memory dict |
import_from_file(filename, package) |
Import from YAML file |