Django eduNEXT Audit Model
Project description
Installation
Install eox-audit-model:
pip install eox-audit-model
Add “eox_audit_model” to your INSTALLED_APPS:
INSTALLED_APPS = [ ... 'eox_audit_model', ]
Run Migrate:
python manage.py migrate eox_audit_model
Open edX compatibility notes
Open edX Release |
Version |
---|---|
Juniper |
>=0.2, < 0.4 |
Koa |
>=0.4, <= 0.7 |
Lilac |
>=0.4, <= 0.7 |
Maple |
>=0.7, <1.0 |
Nutmeg |
>=1.0 |
Olive |
>=2.0 |
Palm |
>=3.0 |
Quince |
>=4.0 |
Redwood |
>=4.2.0 |
Usage
Audit any execution of a method or function. This will create a database register with the following information:
Status. If the process was successful or not.
Action. The string given to identify the process.
Time stamp. The execute date.
Method name. Method or function name.
Captured log. logs generated in the execution.
Traceback log. If there was an exception, this will contain the traceback.
Site. Current site.
Performer. The user who started the method, this depend on the request.user
Input. The values used to execute the method.
Output. The value returned by the method.
Ip. Current ip.
Example:
from eox_audit_model.models import AuditModel
def any_method(parameter1, parameter2, parameter3):
"""Do something"""
return 'Success'
def audit_process():
"""Execute audit process"""
action = "This is a simple action"
parameters = {
"args": (2, 6),
"kwargs": {"parameter3": 9},
}
expected_value = AuditModel.execute_action(action, any_method, parameters)
...
Decorator
There is a simple decorator, which can perform the same process.
Example:
from eox_audit_model.decorators import audit_method
@audit_method(action="This is a simple action")
def any_method(parameter1, parameter2, parameter3):
"""Do something"""
return 'Success'
def audit_process():
"""Execute audit process"""
expected_value = any_method(3, 6, 9)
...
Contributing
Add your contribution policy. (If required)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for eox_audit_model-4.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96df02d32b33f9a836aed1a8853fff68df3801c958558ce1f7c6d0000fba2387 |
|
MD5 | 84f59f3dd01391b308afe0a9506087da |
|
BLAKE2b-256 | 282b53e1586fad7350723468f39384906431f4968fcbd3a2ba3520bd1d7ab998 |