Commit d38a437b authored by Jean-Paul Smets's avatar Jean-Paul Smets

Make sure external source crawling system is part of core DMS.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26774 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 393a5bb1
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="Alarm" module="Products.ERP5Type.Document.Alarm"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_folder_handler</string> </key>
<value> <string>CMFBTreeFolderHandler</string> </value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_senseDocumentToUpdate</string> </value>
</item>
<item>
<key> <string>alarm_date</string> </key>
<value>
<object>
<klass>
<global id="1.1" name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1181318754.93</float>
<string>GMT+2</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Selects documents to update from external_source_module and updates their contents by calling the updateContentFromURL method.</string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document_update_content_alarm</string> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_hour_frequency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute_frequency</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass> <reference id="1.1"/> </klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1148508000.0</float>
<string>GMT+2</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_stop_date</string> </key>
<value>
<object>
<klass> <reference id="1.1"/> </klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>32516114400.0</float>
<string>GMT+2</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>sense_method_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Document Update Content Alarm</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>BTrees.Length</string>
<string>Length</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<tuple>
<string>BTrees.OOBTree</string>
<string>OOBTree</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<tuple>
<tuple>
<string>BTrees.OOBTree</string>
<string>OOBTree</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</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>_body</string> </key>
<value> <string>"""\n
This script selects documents to update.the selection process\n
is based on calculation of the frequency_index and creation_date_index.\n
Documents which their frequency_index and creation_date_index are the\n
same as those calculated, are updated.\n
"""\n
from Products.ERP5Type.DateUtils import convertDateToHour\n
date_dict = {}\n
\n
# Shared function\n
def updateDocumentList(**sql_kw):\n
for document in context.portal_catalog(**sql_kw):\n
document.getObject().activate().updateContentFromURL()\n
\n
#Step1: convert the alarm date into hours\n
alarm_date = convertDateToHour()\n
\n
#Step2: initialize a dictionary with frequencies\n
for frequency in context.portal_categories.update_frequency.contentValues():\n
frequency_reference = frequency.getIntIndex()\n
date_dict[frequency_reference] = alarm_date % frequency_reference\n
\n
#Step3: update documents\n
for frequency_reference, creation_date in date_dict.items():\n
sql_kw = {\'creation_date_index\':creation_date, \'frequency_index\':frequency_reference, \'limit\':None}\n
documents_to_update = len(context.portal_catalog(**sql_kw))\n
max_in_activities = 1000 \n
offset = 0\n
loop = documents_to_update / max_in_activities\n
for i in range(loop):\n
limit = \'%s,%s\' % (offset, max_in_activities)\n
sql_kw[\'limit\'] = limit\n
updateDocumentList(**sql_kw)\n
offset += max_in_activities\n
limit = \'%s,%s\' % (offset, max_in_activities)\n
sql_kw[\'limit\'] = limit\n
updateDocumentList(**sql_kw)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>Products.ERP5Type.DateUtils</string>
<string>convertDateToHour</string>
<string>date_dict</string>
<string>updateDocumentList</string>
<string>alarm_date</string>
<string>_getiter_</string>
<string>_getattr_</string>
<string>context</string>
<string>frequency</string>
<string>frequency_reference</string>
<string>_write_</string>
<string>creation_date</string>
<string>None</string>
<string>sql_kw</string>
<string>len</string>
<string>_apply_</string>
<string>documents_to_update</string>
<string>max_in_activities</string>
<string>offset</string>
<string>loop</string>
<string>range</string>
<string>i</string>
<string>limit</string>
<string>_inplacevar_</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_senseDocumentToUpdate</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
974
977
\ No newline at end of file
classification
contributor
similar
update_frequency
update_frequency
\ No newline at end of file
portal_alarms/document_update_content_alarm
\ No newline at end of file
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