Total Complexity | 2 |
Total Lines | 14 |
Duplicated Lines | 0 % |
Changes | 0 |
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 |