Commit 9cbc3708 authored by Ivan Tyagov's avatar Ivan Tyagov

Cleanup trailing spaces.

parent b33b8afe
...@@ -28,25 +28,25 @@ from zExceptions import BadRequest, NotFound ...@@ -28,25 +28,25 @@ from zExceptions import BadRequest, NotFound
class IngestionPolicy(Folder): class IngestionPolicy(Folder):
""" """
A policy for ingesting raw (usually) data inside ERP5. A policy for ingesting raw (usually) data inside ERP5.
Every Sensor, Data Acquisition Unit or Data Aggregation Unit will be Every Sensor, Data Acquisition Unit or Data Aggregation Unit will be
configured to access a different policy. configured to access a different policy.
Each policy will have a python script which based on input data will find Each policy will have a python script which based on input data will find
respective Data Supply which itself contains all required information for respective Data Supply which itself contains all required information for
later ingestion and analytics. later ingestion and analytics.
""" """
meta_type = 'ERP5 Ingestion Policy' meta_type = 'ERP5 Ingestion Policy'
portal_type = 'Ingestion Policy' portal_type = 'Ingestion Policy'
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
def unpack(self, data): def unpack(self, data):
""" """
Unpack data coming from fluentd. Handly alias. Unpack data coming from fluentd. Handy alias.
""" """
return self.portal_ingestion_policies.unpack(data) return self.portal_ingestion_policies.unpack(data)
security.declarePublic('ingest') security.declarePublic('ingest')
def ingest(self, **kw): def ingest(self, **kw):
""" """
...@@ -65,23 +65,23 @@ class IngestionPolicy(Folder): ...@@ -65,23 +65,23 @@ class IngestionPolicy(Folder):
self.REQUEST.form['data_chunk'] = self.REQUEST._file.read() self.REQUEST.form['data_chunk'] = self.REQUEST._file.read()
finally: finally:
environ['REQUEST_METHOD'] = method environ['REQUEST_METHOD'] = method
tag_parsing_script_id = self.getScriptId() tag_parsing_script_id = self.getScriptId()
if tag_parsing_script_id is None: if tag_parsing_script_id is None:
raise NotFound('No tag parsing script found.') raise NotFound('No tag parsing script found.')
tag_parsing_script = getattr(self, tag_parsing_script_id, None) tag_parsing_script = getattr(self, tag_parsing_script_id, None)
if tag_parsing_script is None: if tag_parsing_script is None:
raise NotFound('No tag parsing script found.') raise NotFound('No tag parsing script found.')
# XXX Compatibility with old ingestion. Must be dropped before merging # XXX Compatibility with old ingestion. Must be dropped before merging
# with wendelin master # with wendelin master
if tag_parsing_script_id == "ERP5Site_handleDefaultFluentdIngestion": if tag_parsing_script_id == "ERP5Site_handleDefaultFluentdIngestion":
return tag_parsing_script(**kw) return tag_parsing_script(**kw)
reference = self.REQUEST.get('reference') reference = self.REQUEST.get('reference')
data_chunk = self.REQUEST.get('data_chunk') data_chunk = self.REQUEST.get('data_chunk')
# the script parses the fluentd tag (reference) and returns a dictionary # the script parses the fluentd tag (reference) and returns a dictionary
# which describes the ingestion movement. Then we use this dictionary to # which describes the ingestion movement. Then we use this dictionary to
...@@ -104,7 +104,7 @@ class IngestionPolicy(Folder): ...@@ -104,7 +104,7 @@ class IngestionPolicy(Folder):
data_operation_script = getattr(self, data_operation_script_id, None) data_operation_script = getattr(self, data_operation_script_id, None)
if data_operation_script is None: if data_operation_script is None:
raise NotFound('No data operation script found.') raise NotFound('No data operation script found.')
ingestion_operation, parameter_dict = data_operation_script(movement_dict,\ ingestion_operation, parameter_dict = data_operation_script(movement_dict,\
reference) reference)
...@@ -114,9 +114,9 @@ class IngestionPolicy(Folder): ...@@ -114,9 +114,9 @@ class IngestionPolicy(Folder):
ingestion_script_id = ingestion_operation.getScriptId() ingestion_script_id = ingestion_operation.getScriptId()
if ingestion_script_id is None: if ingestion_script_id is None:
raise NotFound('No ingestion operation script id defined.') raise NotFound('No ingestion operation script id defined.')
ingestion_script = getattr(self, ingestion_script_id, None) ingestion_script = getattr(self, ingestion_script_id, None)
if ingestion_script is None: if ingestion_script is None:
raise NotFound('No such ingestion script found: %s' %ingestion_script_id) raise NotFound('No such ingestion script found: %s' %ingestion_script_id)
ingestion_script(data_chunk=data_chunk, **parameter_dict) ingestion_script(data_chunk=data_chunk, **parameter_dict)
\ No newline at end of file
...@@ -6,12 +6,6 @@ ...@@ -6,12 +6,6 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>IngestionPolicy</string> </value> <value> <string>IngestionPolicy</string> </value>
...@@ -53,28 +47,13 @@ ...@@ -53,28 +47,13 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -87,7 +66,7 @@ ...@@ -87,7 +66,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -96,7 +75,7 @@ ...@@ -96,7 +75,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
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