Commit 91f59b5d authored by Ivan Tyagov's avatar Ivan Tyagov

Stop passing of REQUEST as a function parameter when it is a global

one (and already used in parts of code) as self.REQUEST.
parent 15463dd0
...@@ -53,21 +53,21 @@ class IngestionPolicy(Folder): ...@@ -53,21 +53,21 @@ 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, REQUEST, **kw): def ingest(self, **kw):
""" """
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.
""" """
environ = REQUEST.environ environ = self.REQUEST.environ
method = environ.pop('REQUEST_METHOD') method = environ.pop('REQUEST_METHOD')
try: try:
if method != 'POST': if method != 'POST':
raise BadRequest('Only POST request is allowed.') raise BadRequest('Only POST request is allowed.')
if REQUEST._file is not None: if self.REQUEST._file is not None:
assert not REQUEST.form, REQUEST.form # Are cgi and HTTPRequest fixed ? assert not self.REQUEST.form, self.REQUEST.form # Are cgi and HTTPRequest fixed ?
# Query string was ignored so parse again, faking a GET request. # Query string was ignored so parse again, faking a GET request.
# Such POST is legit: https://stackoverflow.com/a/14710450 # Such POST is legit: https://stackoverflow.com/a/14710450
REQUEST.processInputs() self.REQUEST.processInputs()
REQUEST.form['data_chunk'] = REQUEST._file.read() self.REQUEST.form['data_chunk'] = self.REQUEST._file.read()
finally: finally:
environ['REQUEST_METHOD'] = method environ['REQUEST_METHOD'] = method
......
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