Commit 0afb9886 authored by Rafael Monnerat's avatar Rafael Monnerat

SlapTool: Cache getComputerUidByReference

parent 18cb316e
...@@ -1467,6 +1467,16 @@ class SlapTool(BaseTool): ...@@ -1467,6 +1467,16 @@ class SlapTool(BaseTool):
@UnrestrictedMethod @UnrestrictedMethod
def _getComputerUidByReference(self, computer_reference): def _getComputerUidByReference(self, computer_reference):
"""
Get the validated computer with this reference.
"""
result = CachingMethod(self._getNonCachedComputerUidByReference,
id='_getNonCachedComputerUidByReference',
cache_factory='slap_cache_factory')(computer_reference)
return result
@UnrestrictedMethod
def _getNonCachedComputerUidByReference(self, computer_reference):
return self.getPortalObject().portal_catalog.unrestrictedSearchResults( return self.getPortalObject().portal_catalog.unrestrictedSearchResults(
portal_type='Computer', reference=computer_reference, portal_type='Computer', reference=computer_reference,
validation_state="validated")[0].UID validation_state="validated")[0].UID
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment