{{cookiecutter.python_package}}.event_handlers   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 2

1 Function

Rating   Name   Duplication   Size   Complexity  
A sample_impl() 0 7 2
1
# -*- coding: utf-8 -*-
2
from atramhasis.protected_resources import ProtectedResourceEvent
3
from atramhasis.protected_resources import ProtectedResourceException
4
from pyramid.events import subscriber
5
6
7
@subscriber(ProtectedResourceEvent)
8
def sample_impl(event):
9
    if event.uri.endswith("2"):
10
        referenced_in = ["urn:someobject", "http://test.test.org/object/2"]
11
        raise ProtectedResourceException(
12
            "resource {0} is still in use, preventing operation".format(event.uri),
13
            referenced_in,
14
        )
15