Commit deb8268b authored by Frédéric Escudié's avatar Frédéric Escudié
Browse files

keep updateLight.

parent e3aee9e8
......@@ -53,8 +53,7 @@ class UploadFieldStorage(cgi.FieldStorage):
return jflowconf.get_tmp_directory()
def make_file(self, binary=None):
jflowconf = JFlowConfigReader()
tmp_folder = jflowconf.get_tmp_directory()
tmp_folder = self.get_tmp_directory()
if not os.path.exists( tmp_folder ):
try : os.mkdir(tmp_folder)
except : pass
......@@ -221,6 +220,28 @@ class JFlowServer (object):
workflow = self.wfmanager.get_workflow(kwargs["workflow_id"])
return self.jsonify_workflow_status(workflow)
@cherrypy.expose
def uploadLight(self, **kwargs):
prefix = ""
for key in kwargs.keys():
if key == "prefix":
prefix = kwargs[key]
else:
file_param = key
# the file transfer can take a long time; by default cherrypy
# limits responses to 300s; we increase it to 1h
cherrypy.response.timeout = 3600
# upload file by chunks
FH_sever_file = open(os.path.join(self.jflow_config_reader.get_tmp_directory(), prefix+"_"+kwargs[file_param].filename.encode('ascii','ignore')), "w")
while True:
data = kwargs[file_param].file.read(8192)
if not data:
break
FH_sever_file.write(data)
FH_sever_file.close()
@cherrypy.expose
@cherrypy.tools.noBodyProcess()
@cherrypy.tools.CORS()
......
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