def call_converter(converter_name): """ :param converter_name: The Converter name """ sync = 'sync' in request.args if converter_name not in ConverterRegistry.converters(): raise UnknownConverter() if request.method == 'POST': sha, information = compute_all(converter_name, request) try: log_request(converter_name, sha, information) except IntegrityError: return jsonify(result='job already done'), 200 # store in the Redis Queue job = current_app.queue.enqueue(run_converter, converter_name, information['connection'], information['data']) if sync: while job.result is None: time.sleep(0.1) return jsonify(result='job accepted'), 200 else: query = Converter.query.filter_by(name=converter_name) converter = query.first() if not converter: messages = [] else: messages = converter.messages return render_template( 'converter_show.html', converter=converter_name, messages=messages )
def call_converter(converter_name): """ :param converter_name: The Converter name """ sync = 'sync' in request.args if converter_name not in ConverterRegistry.converters(): raise UnknownConverter() if request.method == 'POST': sha, information = compute_all(converter_name, request) try: log_request(converter_name, sha, information) except IntegrityError: return jsonify(result='job already done'), 200 # store in the Redis Queue job = current_app.queue.enqueue(run_converter, converter_name, information['connection'], information['data']) if sync: while job.result is None: time.sleep(0.1) return jsonify(result='job accepted'), 200 else: query = Converter.query.filter_by(name=converter_name) converter = query.first() if not converter: messages = [] else: messages = converter.messages return render_template('converter_show.html', converter=converter_name, messages=messages)
def index(): return render_template('index.html', converters=ConverterRegistry.converters())
def index(): return render_template( 'index.html', converters=ConverterRegistry.converters() )