Skip to content

Commit

Permalink
Merge pull request #43 from open-zaak/speeding-up-cmis
Browse files Browse the repository at this point in the history
Speeding up WEBSERVICE binding
  • Loading branch information
sergei-maertens authored Feb 17, 2021
2 parents b817da8 + f9ef619 commit 4508f04
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
8 changes: 6 additions & 2 deletions drc_cmis/webservice/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,14 @@ def base_url(self):
@property
def main_repo_id(self) -> str:
"""Get ID of the CMS main repository"""
return self.get_main_repo_id()

if self._main_repo_id is None:
configured_main_repo_id = self.config.main_repo_id
def get_main_repo_id(self, cache: bool = True) -> str:
configured_main_repo_id = self.config.main_repo_id
if configured_main_repo_id and cache:
return configured_main_repo_id

if self._main_repo_id is None:
# Retrieving the IDs of all repositories in the CMS
soap_envelope = make_soap_envelope(
auth=(self.user, self.password), cmis_action="getRepositories"
Expand Down
16 changes: 0 additions & 16 deletions tests/test_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,6 @@ def test_set_main_repo_id_if_not_set_in_settings(self):
# In alfresco the repo ID is a UUID
uuid.UUID(main_repo_id)

def test_that_main_repo_id_is_checked(self):
config = CMISConfig.objects.get()
config.main_repo_id = "some-rubbish-id"
config.save()

self.cmis_client._main_repo_id = None

with self.assertRaises(CmisRepositoryDoesNotExist):
try:
self.cmis_client.main_repo_id
except Exception as e:
# Needed or the test clean-up fails!
config.main_repo_id = ""
config.save()
raise e

def test_setting_correct_repo_id(self):
# Finding what the main repo id is
self.cmis_client._main_repo_id = None
Expand Down

0 comments on commit 4508f04

Please sign in to comment.