| Conditions | 2 |
| Total Lines | 24 |
| Code Lines | 17 |
| Lines | 24 |
| Ratio | 100 % |
| Changes | 0 | ||
| 1 | import logging |
||
| 18 | View Code Duplication | def create_registry(request): |
|
| 19 | try: |
||
| 20 | registry = Registry(instance_scope='threaded_thread') |
||
| 21 | |||
| 22 | getty_session = CacheControl(requests.Session(), heuristic=ExpiresAfter(weeks=1)) |
||
| 23 | |||
| 24 | aat = AATProvider( |
||
| 25 | {'id': 'AAT', 'subject': ['external']}, |
||
| 26 | session=getty_session |
||
| 27 | ) |
||
| 28 | |||
| 29 | tgn = TGNProvider( |
||
| 30 | {'id': 'TGN', 'subject': ['external']}, |
||
| 31 | session=getty_session |
||
| 32 | ) |
||
| 33 | |||
| 34 | registry.register_provider(aat) |
||
| 35 | registry.register_provider(tgn) |
||
| 36 | skos.register_providers_from_db(registry, request.db) |
||
| 37 | |||
| 38 | return registry |
||
| 39 | except AttributeError: |
||
| 40 | log.exception("Attribute error during creation of Registry.") |
||
| 41 | raise |
||
| 42 |