@@ -97,9 +97,10 @@ def allowed_objects():
9797 if flask .request .method == "OPTIONS" :
9898 return flask .make_response ({}, 200 )
9999
100- UPLOAD_FOLDER = flask .current_app .config ["UPLOAD_FOLDER" ]
101100 utils_functions .validate_request (flask .request , allowed_objects_json )
102- file_absolute_path = os .path .join (UPLOAD_FOLDER , flask .request .json ["filename" ])
101+ file_absolute_path = geode_functions .upload_file_path (
102+ flask .request .json ["filename" ]
103+ )
103104 allowed_objects = geode_functions .list_geode_objects (
104105 file_absolute_path , flask .request .json ["supported_feature" ]
105106 )
@@ -118,12 +119,11 @@ def allowed_objects():
118119 methods = missing_files_json ["methods" ],
119120)
120121def missing_files ():
121- UPLOAD_FOLDER = flask .current_app .config ["UPLOAD_FOLDER" ]
122122 utils_functions .validate_request (flask .request , missing_files_json )
123-
123+ file_path = geode_functions . upload_file_path ( flask . request . json [ "filename" ])
124124 missing_files = geode_functions .missing_files (
125125 flask .request .json ["input_geode_object" ],
126- os . path . join ( UPLOAD_FOLDER , flask . request . json [ "filename" ]) ,
126+ file_path ,
127127 )
128128 has_missing_files = missing_files .has_missing_files ()
129129
@@ -184,11 +184,9 @@ def crs_converter_geographic_coordinate_systems():
184184 methods = inspect_file_json ["methods" ],
185185)
186186def inspect_file ():
187- UPLOAD_FOLDER = flask .current_app .config ["UPLOAD_FOLDER" ]
188187 utils_functions .validate_request (flask .request , inspect_file_json )
189188
190- secure_filename = werkzeug .utils .secure_filename (flask .request .json ["filename" ])
191- file_path = os .path .abspath (os .path .join (UPLOAD_FOLDER , secure_filename ))
189+ file_path = geode_functions .upload_file_path (flask .request .json ["filename" ])
192190 data = geode_functions .load (flask .request .json ["input_geode_object" ], file_path )
193191 class_inspector = geode_functions .inspect (
194192 flask .request .json ["input_geode_object" ], data
@@ -209,13 +207,13 @@ def inspect_file():
209207 methods = geode_objects_and_output_extensions_json ["methods" ],
210208)
211209def geode_objects_and_output_extensions ():
212- UPLOAD_FOLDER = flask .current_app .config ["UPLOAD_FOLDER" ]
213210 utils_functions .validate_request (
214211 flask .request , geode_objects_and_output_extensions_json
215212 )
213+ file_path = geode_functions .upload_file_path (flask .request .json ["filename" ])
216214 data = geode_functions .load (
217215 flask .request .json ["input_geode_object" ],
218- os . path . join ( UPLOAD_FOLDER , flask . request . json [ "filename" ]) ,
216+ file_path ,
219217 )
220218 geode_objects_and_output_extensions = (
221219 geode_functions .geode_objects_output_extensions (
@@ -241,14 +239,12 @@ def geode_objects_and_output_extensions():
241239)
242240def save_viewable_file ():
243241 utils_functions .validate_request (flask .request , save_viewable_file_json )
244- UPLOAD_FOLDER = flask .current_app .config ["UPLOAD_FOLDER" ]
245- DATA_FOLDER_PATH = flask .current_app .config ["DATA_FOLDER_PATH" ]
246- secure_filename = werkzeug .utils .secure_filename (flask .request .json ["filename" ])
247- file_path = os .path .abspath (os .path .join (UPLOAD_FOLDER , secure_filename ))
242+
243+ file_path = geode_functions .upload_file_path (flask .request .json ["filename" ])
248244 data = geode_functions .load (flask .request .json ["input_geode_object" ], file_path )
249245 return flask .make_response (
250246 utils_functions .generate_native_viewable_and_light_viewable (
251- flask .request .json ["input_geode_object" ], data , DATA_FOLDER_PATH
247+ flask .request .json ["input_geode_object" ], data
252248 ),
253249 200 ,
254250 )
@@ -261,7 +257,6 @@ def save_viewable_file():
261257@routes .route (create_point_json ["route" ], methods = create_point_json ["methods" ])
262258def create_point ():
263259 utils_functions .validate_request (flask .request , create_point_json )
264- DATA_FOLDER_PATH = flask .current_app .config ["DATA_FOLDER_PATH" ]
265260 title = flask .request .json ["title" ]
266261 x = flask .request .json ["x" ]
267262 y = flask .request .json ["y" ]
@@ -273,7 +268,7 @@ def create_point():
273268 builder .set_name (title )
274269 return flask .make_response (
275270 utils_functions .generate_native_viewable_and_light_viewable (
276- "PointSet3D" , PointSet3D , DATA_FOLDER_PATH
271+ "PointSet3D" , PointSet3D
277272 ),
278273 200 ,
279274 )
@@ -288,12 +283,13 @@ def create_point():
288283 methods = texture_coordinates_json ["methods" ],
289284)
290285def texture_coordinates ():
291- DATA_FOLDER_PATH = flask .current_app .config ["DATA_FOLDER_PATH" ]
292286 utils_functions .validate_request (flask .request , texture_coordinates_json )
293- data = geode_functions .load (
287+ data = geode_functions .load_data (
294288 flask .request .json ["input_geode_object" ],
295- os .path .join (DATA_FOLDER_PATH , flask .request .json ["filename" ]),
289+ flask .request .json ["id" ],
290+ flask .request .json ["filename" ],
296291 )
292+
297293 texture_coordinates = data .texture_manager ().texture_names ()
298294
299295 return flask .make_response ({"texture_coordinates" : texture_coordinates }, 200 )
@@ -311,14 +307,13 @@ def texture_coordinates():
311307 methods = vertex_attribute_names_json ["methods" ],
312308)
313309def vertex_attribute_names ():
314- DATA_FOLDER_PATH = flask .current_app .config ["DATA_FOLDER_PATH" ]
315310 utils_functions .validate_request (flask .request , vertex_attribute_names_json )
316- file_absolute_path = os .path .join (
317- DATA_FOLDER_PATH , werkzeug .utils .secure_filename (flask .request .json ["filename" ])
318- )
319- data = geode_functions .load (
320- flask .request .json ["input_geode_object" ], file_absolute_path
311+ data = geode_functions .load_data (
312+ flask .request .json ["input_geode_object" ],
313+ flask .request .json ["id" ],
314+ flask .request .json ["filename" ],
321315 )
316+
322317 vertex_attribute_names = data .vertex_attribute_manager ().attribute_names ()
323318
324319 return flask .make_response (
@@ -341,14 +336,13 @@ def vertex_attribute_names():
341336 methods = polygon_attribute_names_json ["methods" ],
342337)
343338def polygon_attribute_names ():
344- DATA_FOLDER_PATH = flask .current_app .config ["DATA_FOLDER_PATH" ]
345339 utils_functions .validate_request (flask .request , polygon_attribute_names_json )
346- file_absolute_path = os .path .join (
347- DATA_FOLDER_PATH , werkzeug .utils .secure_filename (flask .request .json ["filename" ])
348- )
349- data = geode_functions .load (
350- flask .request .json ["input_geode_object" ], file_absolute_path
340+ data = geode_functions .load_data (
341+ flask .request .json ["input_geode_object" ],
342+ flask .request .json ["id" ],
343+ flask .request .json ["filename" ],
351344 )
345+
352346 polygon_attribute_names = data .polygon_attribute_manager ().attribute_names ()
353347
354348 return flask .make_response (
@@ -371,14 +365,13 @@ def polygon_attribute_names():
371365 methods = polyhedron_attribute_names_json ["methods" ],
372366)
373367def polyhedron_attribute_names ():
374- DATA_FOLDER_PATH = flask .current_app .config ["DATA_FOLDER_PATH" ]
375- utils_functions .validate_request (flask .request , vertex_attribute_names_json )
376- file_absolute_path = os .path .join (
377- DATA_FOLDER_PATH , werkzeug .utils .secure_filename (flask .request .json ["filename" ])
378- )
379- data = geode_functions .load (
380- flask .request .json ["input_geode_object" ], file_absolute_path
368+ utils_functions .validate_request (flask .request , polyhedron_attribute_names_json )
369+ data = geode_functions .load_data (
370+ flask .request .json ["input_geode_object" ],
371+ flask .request .json ["id" ],
372+ flask .request .json ["filename" ],
381373 )
374+
382375 polyhedron_attribute_names = data .polyhedron_attribute_manager ().attribute_names ()
383376
384377 return flask .make_response (
0 commit comments