Commit bb0e066f authored by Łukasz Nowak's avatar Łukasz Nowak

Revert "Revert "Reactivate the internal cache.""

This reverts commit 6d31793b.
parent 362a0b60
...@@ -36,7 +36,7 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed ...@@ -36,7 +36,7 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed
from Products.ERP5Type.Globals import InitializeClass from Products.ERP5Type.Globals import InitializeClass
from Products.ERP5Type.Tool.BaseTool import BaseTool from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
#from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type.Cache import DEFAULT_CACHE_SCOPE from Products.ERP5Type.Cache import DEFAULT_CACHE_SCOPE
from lxml import etree from lxml import etree
import time import time
...@@ -208,25 +208,25 @@ class SlapTool(BaseTool): ...@@ -208,25 +208,25 @@ class SlapTool(BaseTool):
slap_computer._computer_partition_list = [] slap_computer._computer_partition_list = []
if user_type in ('Computer', 'Person'): if user_type in ('Computer', 'Person'):
# if not self._isTestRun(): if not self._isTestRun():
# cache_plugin = self._getCachePlugin() cache_plugin = self._getCachePlugin()
# try: try:
# entry = cache_plugin.get(user, DEFAULT_CACHE_SCOPE) entry = cache_plugin.get(user, DEFAULT_CACHE_SCOPE)
# except KeyError: except KeyError:
# entry = None entry = None
# if entry is not None and type(entry.getValue()) == type({}): if entry is not None and type(entry.getValue()) == type({}):
# result = entry.getValue()['data'] result = entry.getValue()['data']
# if time.time() - entry.getValue()['time'] > 60 * 1: if time.time() - entry.getValue()['time'] > 60 * 1:
# # entry was stored 1 minutes ago, ask for recalculation # entry was stored 1 minutes ago, ask for recalculation
# self._activateFillComputerInformationCache(computer_id, user, full) self._activateFillComputerInformationCache(computer_id, user, full)
# return result return result
# else: else:
# self._activateFillComputerInformationCache(computer_id, user, full) self._activateFillComputerInformationCache(computer_id, user, full)
# self.REQUEST.response.setStatus(503) self.REQUEST.response.setStatus(503)
# return self.REQUEST.response return self.REQUEST.response
# else: else:
# return self._getCacheComputerInformation(computer_id, user, full)
return self._getCacheComputerInformation(computer_id, user, full) return self._getCacheComputerInformation(computer_id, user, full)
# return self._getCacheComputerInformation(computer_id, user, full)
else: else:
slap_computer._software_release_list = [] slap_computer._software_release_list = []
for computer_partition in self.getPortalObject().portal_catalog( for computer_partition in self.getPortalObject().portal_catalog(
...@@ -248,14 +248,14 @@ class SlapTool(BaseTool): ...@@ -248,14 +248,14 @@ class SlapTool(BaseTool):
""" """
user = self.getPortalObject().portal_membership.getAuthenticatedMember().getUserName() user = self.getPortalObject().portal_membership.getAuthenticatedMember().getUserName()
self._logAccess(user, user, '#access %s' % computer_id) self._logAccess(user, user, '#access %s' % computer_id)
# if not self._isTestRun(): if not self._isTestRun():
# result = CachingMethod(self._getComputerInformation, result = CachingMethod(self._getComputerInformation,
# id='_getComputerInformation', id='_getComputerInformation',
# cache_factory='slap_cache_factory')( cache_factory='slap_cache_factory')(
# computer_id, user, False) computer_id, user, False)
# else: else:
# result = self._getComputerInformation(computer_id, user, False)
result = self._getComputerInformation(computer_id, user, False) result = self._getComputerInformation(computer_id, user, False)
# result = self._getComputerInformation(computer_id, user, False)
# Keep in cache server for 7 days # Keep in cache server for 7 days
self.REQUEST.response.setStatus(200) self.REQUEST.response.setStatus(200)
...@@ -278,14 +278,14 @@ class SlapTool(BaseTool): ...@@ -278,14 +278,14 @@ class SlapTool(BaseTool):
""" """
user = self.getPortalObject().portal_membership.getAuthenticatedMember().getUserName() user = self.getPortalObject().portal_membership.getAuthenticatedMember().getUserName()
self._logAccess(user, user, '#access %s' % computer_id) self._logAccess(user, user, '#access %s' % computer_id)
# if not self._isTestRun(): if not self._isTestRun():
# return CachingMethod(self._getComputerInformation, return CachingMethod(self._getComputerInformation,
# id='_getFullComputerInformation', id='_getFullComputerInformation',
# cache_factory='slap_cache_factory')( cache_factory='slap_cache_factory')(
# computer_id, user, True) computer_id, user, True)
# else: else:
# return self._getComputerInformation(computer_id, user, True) return self._getComputerInformation(computer_id, user, True)
result = self._getComputerInformation(computer_id, user, True) # result = self._getComputerInformation(computer_id, user, True)
# Keep in cache server for 7 days # Keep in cache server for 7 days
self.REQUEST.response.setStatus(200) self.REQUEST.response.setStatus(200)
......
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