Skip to content

Commit

Permalink
#97 bugfix concept scheme initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
vancamti committed Feb 4, 2021
1 parent 4de204a commit 72229b7
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions skosprovider_atramhasis/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@
import logging

import requests
from requests.exceptions import ConnectionError, Timeout
from dogpile.cache import make_region
from requests.exceptions import ConnectionError
from requests.exceptions import Timeout
from skosprovider.exceptions import ProviderUnavailableException
from skosprovider.providers import VocabularyProvider
from skosprovider.skos import ConceptScheme
from skosprovider.skos import Label
from skosprovider.skos import Note
from skosprovider.skos import dict_to_source

from skosprovider_atramhasis.cache_utils import _atramhasis_key_generator
from skosprovider_atramhasis.cache_utils import _cache_on_arguments
from skosprovider_atramhasis.utils import dict_to_thing
from skosprovider.exceptions import ProviderUnavailableException
from skosprovider.providers import VocabularyProvider
from skosprovider.skos import ConceptScheme, Label, Note, dict_to_source

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -49,6 +52,7 @@ def __init__(self, metadata, **kwargs):
if not 'subject' in metadata:
metadata['subject'] = []
self.metadata = metadata
self._conceptscheme = None
self.allowed_instance_scopes = kwargs.get(
'allowed_instance_scopes',
['single', 'threaded_thread']
Expand Down Expand Up @@ -81,7 +85,9 @@ def __init__(self, metadata, **kwargs):

@property
def concept_scheme(self):
return self._get_concept_scheme()
if self._conceptscheme is None:
self._conceptscheme = self._get_concept_scheme()
return self._conceptscheme

def _get_concept_scheme(self):
request = self.base_url + '/conceptschemes/' + self.scheme_id
Expand Down

0 comments on commit 72229b7

Please sign in to comment.