Completed
Push — master ( 78de89...99647d )
by
unknown
02:14 queued 58s
created

audit_manager()   A

Complexity

Conditions 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 11
rs 9.4285
1
# -*- coding: utf-8 -*-
2
from oe_utils.data.data_managers import AuditManager
3
import logging
4
5
log = logging.getLogger(__name__)
6
7
8
def audit_manager(request):
9
    """
10
    Method to initialize and return the audit manager.
11
12
    The request must contain a method `request.db` to retrieve the current session.
13
14
    :param request: `pyramid.request.Request`
15
    :return: the audit manager
16
    """
17
    session = request.db
18
    return AuditManager(session)
19
20
21
def includeme(config):
22
    """
23
    Configure a `request.audit_managers` method to retrieve the audit manager
24
25
    :param config:
26
    """
27
    config.add_request_method(audit_manager, reify=True)
28