Commit edff96ea authored by Ivan Tyagov's avatar Ivan Tyagov

Allow to configure data operation finding script ar Ingestion Policy level as

in some project this is required.
Remove obsolete script.
parent 238f0262
...@@ -102,9 +102,17 @@ class IngestionPolicy(Folder): ...@@ -102,9 +102,17 @@ class IngestionPolicy(Folder):
# and resource are defined on Data Ingestion Line and the rest is # and resource are defined on Data Ingestion Line and the rest is
# defined on Data Ingestion. This assumption should be dropped later and # defined on Data Ingestion. This assumption should be dropped later and
# simulation be used instead. # simulation be used instead.
ingestion_operation, parameter_dict = \ data_operation_script_id = self.getDataOperationScriptId()
self.IngestionPolicy_getIngestionOperationAndParameterDict(movement_dict, if data_operation_script_id is None:
reference) raise NotFound('No data operation script found.')
data_operation_script = getattr(self, data_operation_script_id, None)
if data_operation_script is None:
raise NotFound('No data operation script found.')
ingestion_operation, parameter_dict = data_operation_script(movement_dict,\
reference)
if ingestion_operation is None: if ingestion_operation is None:
raise NotFound('No ingestion operation found.') raise NotFound('No ingestion operation found.')
......
...@@ -65,4 +65,4 @@ ...@@ -65,4 +65,4 @@
<portal_type id="Progress Indicator"> <portal_type id="Progress Indicator">
<item>OffsetIndex</item> <item>OffsetIndex</item>
</portal_type> </portal_type>
</property_sheet_list> </property_sheet_list>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/string</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Script which will find respective Data Operation.</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>data_operation_script_id_property</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
<item>
<key> <string>property_default</string> </key>
<value> <string>string:IngestionPolicy_getIngestionOperationAndParameterDict</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
<string>my_reference</string> <string>my_reference</string>
<string>my_version</string> <string>my_version</string>
<string>my_script_id</string> <string>my_script_id</string>
<string>my_data_operation_script_id</string>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>description</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_data_operation_script_id</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string>Id of script responsible for parsing the passed ingestion reference.</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Parse script Id</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string>Id of script responsible for locating the right Data Supply instance describing this ingestion policy</string> </value> <value> <string>Id of script responsible for finding the right Data Operation.</string> </value>
</item> </item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Script Id</string> </value> <value> <string>Find Data Operation Script Id</string> </value>
</item> </item>
</dictionary> </dictionary>
</value> </value>
......
"""
Add a data supply structure for a data ingestion on a portal ingestion policy.
"""
data_supply = context.data_supply_module.newContent( \
portal_type='Data Supply', **data_supply_kw)
data_supply.validate()
# add default line
data_supply_line = data_supply.newContent(portal_type='Data Supply Line', \
**data_supply_line_kw)
return data_supply
<?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>data_supply_kw, data_supply_line_kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PortalIngestionPolicy_addDataSupply</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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