@@ -75,7 +75,7 @@ def upload_file():
7575
7676 UPLOAD_FOLDER = flask .current_app .config ["UPLOAD_FOLDER" ]
7777 if not os .path .exists (UPLOAD_FOLDER ):
78- os .makedirs (UPLOAD_FOLDER )
78+ os .mkdir (UPLOAD_FOLDER )
7979 file = flask .request .files ["file" ]
8080 filename = werkzeug .utils .secure_filename (os .path .basename (file .filename ))
8181 file .save (os .path .join (UPLOAD_FOLDER , filename ))
@@ -99,7 +99,8 @@ def allowed_objects():
9999
100100 UPLOAD_FOLDER = flask .current_app .config ["UPLOAD_FOLDER" ]
101101 utils_functions .validate_request (flask .request , allowed_objects_json )
102- file_absolute_path = os .path .join (UPLOAD_FOLDER , flask .request .json ["filename" ])
102+ file_absolute_path = geode_functions .build_upload_file_path (
103+ UPLOAD_FOLDER , flask .request .json ["filename" ])
103104 allowed_objects = geode_functions .list_geode_objects (
104105 file_absolute_path , flask .request .json ["supported_feature" ]
105106 )
@@ -123,7 +124,8 @@ def missing_files():
123124
124125 missing_files = geode_functions .missing_files (
125126 flask .request .json ["input_geode_object" ],
126- os .path .join (UPLOAD_FOLDER , flask .request .json ["filename" ]),
127+ geode_functions .build_upload_file_path (
128+ UPLOAD_FOLDER , flask .request .json ["filename" ]),
127129 )
128130 has_missing_files = missing_files .has_missing_files ()
129131
@@ -215,7 +217,8 @@ def geode_objects_and_output_extensions():
215217 )
216218 data = geode_functions .load (
217219 flask .request .json ["input_geode_object" ],
218- os .path .join (UPLOAD_FOLDER , flask .request .json ["filename" ]),
220+ geode_functions .build_upload_file_path (
221+ UPLOAD_FOLDER , flask .request .json ["filename" ]),
219222 )
220223 geode_objects_and_output_extensions = (
221224 geode_functions .geode_objects_output_extensions (
@@ -288,12 +291,12 @@ def create_point():
288291def texture_coordinates ():
289292 DATA_FOLDER_PATH = flask .current_app .config ["DATA_FOLDER_PATH" ]
290293 utils_functions .validate_request (flask .request , texture_coordinates_json )
291- data = geode_functions .load (
292- flask .request .json ["input_geode_object" ],
293- os . path . join (
294- DATA_FOLDER_PATH , flask .request .json [ "id" ], flask . request . json [ "filename" ]
295- ),
296- )
294+ data = geode_functions .load_from_request (
295+ flask .request .json ["input_geode_object" ],
296+ DATA_FOLDER_PATH ,
297+ flask .request .json ,
298+ )
299+
297300 texture_coordinates = data .texture_manager ().texture_names ()
298301
299302 return flask .make_response ({"texture_coordinates" : texture_coordinates }, 200 )
@@ -313,14 +316,12 @@ def texture_coordinates():
313316def vertex_attribute_names ():
314317 DATA_FOLDER_PATH = flask .current_app .config ["DATA_FOLDER_PATH" ]
315318 utils_functions .validate_request (flask .request , vertex_attribute_names_json )
316- file_absolute_path = os .path .join (
317- DATA_FOLDER_PATH ,
318- flask .request .json ["id" ],
319- werkzeug .utils .secure_filename (flask .request .json ["filename" ]),
320- )
321- data = geode_functions .load (
322- flask .request .json ["input_geode_object" ], file_absolute_path
319+ data = geode_functions .load_from_request (
320+ flask .request .json ["input_geode_object" ],
321+ DATA_FOLDER_PATH ,
322+ flask .request .json ,
323323 )
324+
324325 vertex_attribute_names = data .vertex_attribute_manager ().attribute_names ()
325326
326327 return flask .make_response (
@@ -345,14 +346,12 @@ def vertex_attribute_names():
345346def polygon_attribute_names ():
346347 DATA_FOLDER_PATH = flask .current_app .config ["DATA_FOLDER_PATH" ]
347348 utils_functions .validate_request (flask .request , polygon_attribute_names_json )
348- file_absolute_path = os .path .join (
349- DATA_FOLDER_PATH ,
350- flask .request .json ["id" ],
351- werkzeug .utils .secure_filename (flask .request .json ["filename" ]),
352- )
353- data = geode_functions .load (
354- flask .request .json ["input_geode_object" ], file_absolute_path
349+ data = geode_functions .load_from_request (
350+ flask .request .json ["input_geode_object" ],
351+ DATA_FOLDER_PATH ,
352+ flask .request .json ,
355353 )
354+
356355 polygon_attribute_names = data .polygon_attribute_manager ().attribute_names ()
357356
358357 return flask .make_response (
@@ -377,14 +376,12 @@ def polygon_attribute_names():
377376def polyhedron_attribute_names ():
378377 DATA_FOLDER_PATH = flask .current_app .config ["DATA_FOLDER_PATH" ]
379378 utils_functions .validate_request (flask .request , vertex_attribute_names_json )
380- file_absolute_path = os .path .join (
381- DATA_FOLDER_PATH ,
382- flask .request .json ["id" ],
383- werkzeug .utils .secure_filename (flask .request .json ["filename" ]),
384- )
385- data = geode_functions .load (
386- flask .request .json ["input_geode_object" ], file_absolute_path
379+ data = geode_functions .load_from_request (
380+ flask .request .json ["input_geode_object" ],
381+ DATA_FOLDER_PATH ,
382+ flask .request .json ,
387383 )
384+
388385 polyhedron_attribute_names = data .polyhedron_attribute_manager ().attribute_names ()
389386
390387 return flask .make_response (
0 commit comments