def process_zip_for_index():
if not safe_str_cmp(request.form.get('secret', ''),
current_app.config['SEARCH_INDEX_SECRET']):
abort(403)
index_path = get_index_path()
config = json.load(request.files['config'])
archive = release_file(request, 'archive')
try:
shutil.rmtree(index_path)
except (OSError, IOError):
pass
def generate():
for event in index_tree(config, from_zip=archive,
index_path=index_path):
yield '%s\n' % event.encode('utf-8')
return Response(generate(), direct_passthrough=True,
headers={'X-Accel-Buffering': 'no'},
mimetype='text/plain')
评论列表
文章目录