Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Klaus Wölfel
wendelin
Commits
70aa6521
Commit
70aa6521
authored
Jul 11, 2019
by
Klaus Wölfel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IngestionPolicy: accept data chunk as application/octet-stream
parent
9478b175
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.IngestionPolicy.py
...teItem/portal_components/document.erp5.IngestionPolicy.py
+16
-5
No files found.
bt5/erp5_wendelin/DocumentTemplateItem/portal_components/document.erp5.IngestionPolicy.py
View file @
70aa6521
...
@@ -53,12 +53,23 @@ class IngestionPolicy(Folder):
...
@@ -53,12 +53,23 @@ class IngestionPolicy(Folder):
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
,
REQUEST
):
"""
"""
Ingest chunk of raw data either from a Sensor or any of DAUs.
Ingest chunk of raw data either from a Sensor or any of DAUs.
"""
"""
if
self
.
REQUEST
.
method
!=
'POST'
:
environ
=
REQUEST
.
environ
raise
BadRequest
(
'Only POST request is allowed.'
)
method
=
environ
.
pop
(
'REQUEST_METHOD'
)
try
:
if
method
!=
'POST'
:
raise
BadRequest
(
'Only POST request is allowed.'
)
if
REQUEST
.
_file
is
not
None
:
assert
not
REQUEST
.
form
,
REQUEST
.
form
# Are cgi and HTTPRequest fixed ?
# Query string was ignored so parse again, faking a GET request.
# Such POST is legit: https://stackoverflow.com/a/14710450
REQUEST
.
processInputs
()
REQUEST
.
form
[
'data_chunk'
]
=
REQUEST
.
_file
.
read
()
finally
:
environ
[
'REQUEST_METHOD'
]
=
method
tag_parsing_script_id
=
self
.
getScriptId
()
tag_parsing_script_id
=
self
.
getScriptId
()
...
@@ -72,7 +83,7 @@ class IngestionPolicy(Folder):
...
@@ -72,7 +83,7 @@ class IngestionPolicy(Folder):
# 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
()
reference
=
self
.
REQUEST
.
get
(
'reference'
)
reference
=
self
.
REQUEST
.
get
(
'reference'
)
data_chunk
=
self
.
REQUEST
.
get
(
'data_chunk'
)
data_chunk
=
self
.
REQUEST
.
get
(
'data_chunk'
)
...
@@ -105,4 +116,4 @@ class IngestionPolicy(Folder):
...
@@ -105,4 +116,4 @@ class IngestionPolicy(Folder):
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment