Skip to content

Commit 5ce06e8

Browse files
authored
Merge branch 'dev' into testing/risk-acceptance-filter
2 parents 7a0ed0a + 29fb41e commit 5ce06e8

24 files changed

Lines changed: 1751 additions & 1492 deletions

dojo/auditlog.py

Lines changed: 0 additions & 1083 deletions
This file was deleted.

dojo/auditlog/__init__.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""
2+
Audit-log package for DefectDojo.
3+
4+
The public API is exposed lazily via PEP 562 so that importing
5+
``dojo.auditlog`` (and especially ``dojo.auditlog.settings``) at Django
6+
settings-load time does not pull in submodules that depend on
7+
``django.conf.settings`` or other not-yet-built parts of the dojo app.
8+
"""
9+
import importlib
10+
11+
_LAZY_EXPORTS = { # noqa: RUF067 -- table backs the PEP 562 __getattr__ re-export
12+
"run_flush_auditlog": "dojo.auditlog.services",
13+
"configure_audit_system": "dojo.auditlog.services",
14+
"configure_pghistory_triggers": "dojo.auditlog.services",
15+
"register_django_pghistory_models": "dojo.auditlog.services",
16+
"process_events_for_display": "dojo.auditlog.helpers",
17+
"get_tracked_models": "dojo.auditlog.backfill",
18+
"process_model_backfill": "dojo.auditlog.backfill",
19+
}
20+
21+
22+
def __getattr__(name):
23+
module_path = _LAZY_EXPORTS.get(name)
24+
if module_path is None:
25+
msg = f"module 'dojo.auditlog' has no attribute {name!r}"
26+
raise AttributeError(msg)
27+
return getattr(importlib.import_module(module_path), name)

0 commit comments

Comments
 (0)