OpenGeodeWeb-Back 5.8.4rc2__py3-none-any.whl → 5.8.5rc1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,6 @@ import time
6
6
  # Third party imports
7
7
  import flask
8
8
  import opengeode
9
- import uuid
10
9
  import werkzeug
11
10
 
12
11
  # Local application imports
@@ -247,10 +246,12 @@ def save_viewable_file():
247
246
  secure_filename = werkzeug.utils.secure_filename(flask.request.json["filename"])
248
247
  file_path = os.path.abspath(os.path.join(UPLOAD_FOLDER, secure_filename))
249
248
  data = geode_functions.load(flask.request.json["input_geode_object"], file_path)
250
- response_data = utils_functions.create_response_with_binary_light_viewable(
251
- flask.request.json["input_geode_object"], data, DATA_FOLDER_PATH
249
+ return flask.make_response(
250
+ utils_functions.generate_native_viewable_and_light_viewable(
251
+ flask.request.json["input_geode_object"], data, DATA_FOLDER_PATH
252
+ ),
253
+ 200,
252
254
  )
253
- return flask.jsonify(response_data), 200
254
255
 
255
256
 
256
257
  with open(os.path.join(schemas, "create_point.json"), "r") as file:
@@ -271,7 +272,7 @@ def create_point():
271
272
  builder.create_point(opengeode.Point3D([x, y, z]))
272
273
  builder.set_name(title)
273
274
  return flask.make_response(
274
- utils_functions.create_response_with_binary_light_viewable(
275
+ utils_functions.generate_native_viewable_and_light_viewable(
275
276
  "PointSet3D", PointSet3D, DATA_FOLDER_PATH
276
277
  ),
277
278
  200,
@@ -17,13 +17,10 @@ with open(os.path.join(schemas, "vtm_component_indices.json"), "r") as file:
17
17
  vtm_component_indices_json["route"], methods=vtm_component_indices_json["methods"]
18
18
  )
19
19
  def uuid_to_flat_index():
20
-
21
- print(f"uuid_to_flat_index : {flask.request=}", flush=True)
22
20
  utils_functions.validate_request(flask.request, vtm_component_indices_json)
23
21
  vtm_file_path = os.path.join(
24
22
  flask.current_app.config["DATA_FOLDER_PATH"], flask.request.json["id"] + ".vtm"
25
23
  )
26
-
27
24
  tree = ET.parse(vtm_file_path)
28
25
  root = tree.find("vtkMultiBlockDataSet")
29
26
  uuid_to_flat_index = {}
@@ -60,16 +57,11 @@ with open(os.path.join(schemas, "mesh_components.json"), "r") as file:
60
57
 
61
58
  @routes.route(mesh_components_json["route"], methods=mesh_components_json["methods"])
62
59
  def extract_uuids_endpoint():
63
- print(f"extract_uuids_endpoint : {flask.request=}", flush=True)
64
-
65
60
  utils_functions.validate_request(flask.request, mesh_components_json)
66
-
67
61
  file_path = os.path.join(
68
62
  flask.current_app.config["DATA_FOLDER_PATH"], flask.request.json["filename"]
69
63
  )
70
-
71
64
  if not os.path.exists(file_path):
72
65
  return flask.make_response({"error": "File not found"}, 404)
73
-
74
66
  uuid_dict = extract_model_uuids(flask.request.json["geode_object"], file_path)
75
67
  return flask.make_response({"uuid_dict": uuid_dict}, 200)
@@ -143,8 +143,13 @@ def handle_exception(e):
143
143
  return response
144
144
 
145
145
 
146
- def save_native_viewable_binary_file_names(geode_object, data, folder_absolute_path):
146
+ def generate_native_viewable_and_light_viewable(
147
+ geode_object, data, folder_absolute_path
148
+ ):
147
149
  generated_id = str(uuid.uuid4()).replace("-", "")
150
+ name = data.name()
151
+ object_type = geode_functions.get_object_type(geode_object)
152
+
148
153
  saved_native_file_path = geode_functions.save(
149
154
  geode_object,
150
155
  data,
@@ -160,30 +165,13 @@ def save_native_viewable_binary_file_names(geode_object, data, folder_absolute_p
160
165
  f = open(saved_light_viewable_file_path, "rb")
161
166
  binary_light_viewable = f.read()
162
167
  f.close()
163
- return {
164
- "native_file_name": os.path.basename(saved_native_file_path[0]),
165
- "viewable_file_name": os.path.basename(saved_viewable_file_path[0]),
166
- "binary_light_viewable": str(binary_light_viewable, "utf-8"),
167
- }
168
-
169
-
170
- def create_response_with_binary_light_viewable(
171
- geode_object, data, folder_absolute_path
172
- ):
173
- generated_id = str(uuid.uuid4()).replace("-", "")
174
- name = data.name()
175
- object_type = geode_functions.get_object_type(geode_object)
176
-
177
- native_file_name, viewable_file_name, binary_light_viewable = (
178
- save_native_viewable_binary_file_names(geode_object, data, folder_absolute_path)
179
- )
180
168
 
181
169
  return {
182
170
  "name": name,
183
- "native_file_name": native_file_name,
184
- "viewable_file_name": viewable_file_name,
171
+ "native_file_name": os.path.basename(saved_native_file_path[0]),
172
+ "viewable_file_name": os.path.basename(saved_viewable_file_path),
185
173
  "id": generated_id,
186
174
  "object_type": object_type,
187
- "binary_light_viewable": binary_light_viewable,
175
+ "binary_light_viewable": str(binary_light_viewable, "utf-8"),
188
176
  "geode_object": geode_object,
189
177
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OpenGeodeWeb-Back
3
- Version: 5.8.4rc2
3
+ Version: 5.8.5rc1
4
4
  Summary: OpenGeodeWeb-Back is an open source framework that proposes handy python functions and wrappers for the OpenGeode ecosystem
5
5
  Author-email: Geode-solutions <team-web@geode-solutions.com>
6
6
  Project-URL: Homepage, https://github.com/Geode-solutions/OpenGeodeWeb-Back
@@ -3,9 +3,9 @@ opengeodeweb_back/app_config.py,sha256=gJfYxDJOa_PYLqjqgdXacp3W3F109uujE9LGPvzHO
3
3
  opengeodeweb_back/geode_functions.py,sha256=EPAM6pw9QwZfoeZjOxycFTKUANw6pdeXr2q3vsnPxt8,9121
4
4
  opengeodeweb_back/geode_objects.py,sha256=13A9FTGugiA9ClSeYkBiCu5QGzm93nm8YJQwiWB4nNw,25995
5
5
  opengeodeweb_back/test_utils.py,sha256=18AbRW9-tfKkPcmRGilTTHXI7S3armYyV7Vdy5UvUKM,794
6
- opengeodeweb_back/utils_functions.py,sha256=fghIbadgRBCmjiHQ6h_Sh8_96cznt2FlqNcQEpfYyKE,5732
7
- opengeodeweb_back/routes/blueprint_routes.py,sha256=o1G6gEeRcQUDPWy5OxBorFMB-bpwjuJr0yL4Ex_Lg24,12341
8
- opengeodeweb_back/routes/models/blueprint_models.py,sha256=F5Rx1UpAII2oz75byx4UWvEWrrwY38xO5rsy6B9_AeM,2321
6
+ opengeodeweb_back/utils_functions.py,sha256=RXMdQlCK3bLWYYDhkwOlYCeMpSRjMCejNlqDhxo2VNI,5254
7
+ opengeodeweb_back/routes/blueprint_routes.py,sha256=uqcDIXa2Q7HRShEEVFJcOB6NAxPAYO1VyBMPxtyKl_0,12334
8
+ opengeodeweb_back/routes/models/blueprint_models.py,sha256=EPSlgHnxZVeXwdzJ_TBAHlK6SsjXDk3f1sPYWR5eEL4,2183
9
9
  opengeodeweb_back/routes/models/schemas/mesh_components.json,sha256=3hgNqkxKDv691JGgjgMoqI_WgH2m7AtEFfjsOIqAz5Y,295
10
10
  opengeodeweb_back/routes/models/schemas/vtm_component_indices.json,sha256=0km8gzawPj-eFodhaGzAgNZjAEOl4wLy24f_Bs3pBlw,217
11
11
  opengeodeweb_back/routes/schemas/allowed_files.json,sha256=pRsGf39LiJpl3zEGLg4IqvRtm7iUx3Wq4Tb4tSFXGV0,234
@@ -22,8 +22,8 @@ opengeodeweb_back/routes/schemas/save_viewable_file.json,sha256=pvvEdaC7bNASPMrl
22
22
  opengeodeweb_back/routes/schemas/texture_coordinates.json,sha256=m0EqxlvKojXVxK5Csucodu3rq1YMVJPwXJN_Wreb3qc,355
23
23
  opengeodeweb_back/routes/schemas/upload_file.json,sha256=LJ3U3L5ApKuQDVFIpVT_y2alq4HW_suTvZ3HUucNbhg,219
24
24
  opengeodeweb_back/routes/schemas/vertex_attribute_names.json,sha256=bya9KGtTmHFWjD-ur0_0UAY2yf3KkMeuNrk6E1UkjLM,358
25
- opengeodeweb_back-5.8.4rc2.dist-info/licenses/LICENSE,sha256=LoTB-aqQvzTGxoTRXNnhNV0LKiqdk2bQv6MB34l8zkI,1079
26
- opengeodeweb_back-5.8.4rc2.dist-info/METADATA,sha256=AvDrg_aRYZnCVsh58dzIxh_iEd-0PYvSGtxTcda7eJ4,3036
27
- opengeodeweb_back-5.8.4rc2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
28
- opengeodeweb_back-5.8.4rc2.dist-info/top_level.txt,sha256=tN1FZeLIVBrdja2-pbmhg5-tK-JILmmT9OeIBnhlUrQ,18
29
- opengeodeweb_back-5.8.4rc2.dist-info/RECORD,,
25
+ opengeodeweb_back-5.8.5rc1.dist-info/licenses/LICENSE,sha256=LoTB-aqQvzTGxoTRXNnhNV0LKiqdk2bQv6MB34l8zkI,1079
26
+ opengeodeweb_back-5.8.5rc1.dist-info/METADATA,sha256=CX9PRbGcCA-n220LliBfA9hqGu_nIPq2TohrgxvEz5s,3036
27
+ opengeodeweb_back-5.8.5rc1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
28
+ opengeodeweb_back-5.8.5rc1.dist-info/top_level.txt,sha256=tN1FZeLIVBrdja2-pbmhg5-tK-JILmmT9OeIBnhlUrQ,18
29
+ opengeodeweb_back-5.8.5rc1.dist-info/RECORD,,