Commit c1058afd authored by Romain Courteaud's avatar Romain Courteaud

Prevent calling instance bang too often when not needed.

parent a1f378f7
......@@ -931,7 +931,18 @@ class SlapTool(BaseTool):
getAuthenticatedMember().getUserName()
self._logAccess(user, software_instance.getReference(),
'#error bang called')
return software_instance.bang(bang_tree=True, comment=message)
timestamp = str(int(software_instance.getModificationDate()))
key = "%s_bangstamp" % software_instance.getReference()
result = "OK"
transition = self.getPortalObject().portal_workflow.getInfoFor(
software_instance, 'action', wf_id='instance_slap_interface_workflow')
if (self._getLastData(key) != timestamp) and \
(transition != 'bang'):
result = software_instance.bang(bang_tree=True, comment=message)
self._storeLastData(key, str(int(software_instance.getModificationDate())))
return result
def _getAccessStatus(self, context_reference):
memcached_dict = self._getMemcachedDict()
......
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