File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414from .options import OPTIONS
1515from .readers import registry
1616from .utils import checkpw , human2bytes
17+ from .writers .jcamp import JcampWriter
1718from .writers .jcampzip import JcampZipWriter
1819
1920
@@ -104,7 +105,17 @@ def retrieve_conversion():
104105 converter .process ()
105106
106107 if converter .tables :
107- writer = JcampZipWriter (converter )
108+ conversion_format = request .form .get ('format' , 'jcampzip' )
109+
110+ if conversion_format == 'jcampzip' :
111+ writer = JcampZipWriter (converter )
112+ elif conversion_format == 'jcamp' :
113+ if len (converter .tables ) == 1 :
114+ writer = JcampWriter (converter )
115+ else :
116+ return jsonify ({'error' : 'Conversion to a single JCAMP file is not supported for this file.' }), 400
117+ else :
118+ return jsonify ({'error' : 'Conversion format is not supported.' }), 400
108119 else :
109120 return jsonify ({'error' : 'No tables could be converted.' }), 400
110121
You can’t perform that action at this time.
0 commit comments