Commit 85d97498 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Titouan Soulard

erp5_api_style: Simplify Alarm to update Revision List

parent 4e390879
......@@ -73,11 +73,15 @@
</item>
<item>
<key> <string>configuration_form_id</string> </key>
<value> <string>Alarm_viewConsistencyCheckConfiguration</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Clone this alarm for you projects and configure it through the Configuration Tab</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
......
kw = {}
if not context.Base_zCheckjIOAPIRevisionTableExists():
context.Base_zCreatejIOAPIRevisionTable()
if context.getProperty('incremental_check'):
last_active_process = context.getLastActiveProcess()
if last_active_process is not None:
kw['indexation_timestamp'] = '>= %s' % last_active_process.getStartDate().ISO()
active_process = context.newActiveProcess().getRelativeUrl()
query_string = context.getProperty('catalog_query_string', '')
# the query sould be something like "validation_state:!=deleted validation_state:!=draft portal_type:Organisation" etc
portal = context.getPortalObject()
if query_string is not None:
kw.update(SearchableText=query_string)
kw.update(parent_uid=[portal.restrictedTraverse(module).getUid() for module in context.getProperty('module_list') or []])
object_list = portal.portal_catalog(**kw)
for element in object_list:
element.getObject().updateJIOAPIRevision()
# Get the list of objects that should have a jio api revision but do not have
potentially_missing_object_list = portal.Base_zSelectMissingJIOAPIRevisionObjectList()
for element in potentially_missing_object_list:
portal.unrestrictedTraverse(element.relative_url).updateJIOAPIRevision()
# Catch any objects that might have fell through the cracks
object_list = context.Base_zSelectOutdatedjIOAPIRevisionTable()
for element in object_list:
# Get the list of objects that have a jio api revision and where indexation timestamp has changed since last check
updatable_object_list = context.Base_zSelectUpdatableJIOAPIRevisionObjectList()
for element in updatable_object_list:
portal.unrestrictedTraverse(element.relative_url).updateJIOAPIRevision()
context.activate(after_tag=tag).getId()
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_zSelectMissingJIOAPIRevisionObjectList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -59,7 +59,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_zSelectOutdatedjIOAPIRevisionTable</string> </value>
<value> <string>Base_zSelectUpdatableJIOAPIRevisionObjectList</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
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