OpenGeodeWeb-Back 5.10.3rc18__py3-none-any.whl → 5.10.4rc2__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.

Potentially problematic release.


This version of OpenGeodeWeb-Back might be problematic. Click here for more details.

opengeodeweb_back/app.py CHANGED
@@ -14,7 +14,7 @@ from werkzeug.exceptions import HTTPException
14
14
  from opengeodeweb_back import utils_functions, app_config
15
15
  from opengeodeweb_back.routes import blueprint_routes
16
16
  from opengeodeweb_back.routes.models import blueprint_models
17
- from opengeodeweb_microservice.database.connection import init_database
17
+ from opengeodeweb_microservice.database import connection
18
18
 
19
19
 
20
20
  """ Global config """
@@ -39,6 +39,16 @@ SECONDS_BETWEEN_SHUTDOWNS: float = float(
39
39
  )
40
40
 
41
41
 
42
+ @app.before_request
43
+ def before_request() -> None:
44
+ utils_functions.before_request(flask.current_app)
45
+
46
+
47
+ @app.teardown_request
48
+ def teardown_request(exception: BaseException | None) -> None:
49
+ utils_functions.teardown_request(flask.current_app, exception)
50
+
51
+
42
52
  app.register_blueprint(
43
53
  blueprint_routes.routes,
44
54
  url_prefix="/opengeodeweb_back",
@@ -146,7 +156,7 @@ def run_server() -> None:
146
156
  app.config["SQLALCHEMY_DATABASE_URI"] = f"sqlite:///{db_path}"
147
157
  app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
148
158
 
149
- init_database(db_path)
159
+ connection.init_database(db_path)
150
160
  print(f"Database initialized at: {db_path}", flush=True)
151
161
 
152
162
  app.run(debug=args.debug, host=args.host, port=args.port, ssl_context=SSL)
@@ -16,20 +16,6 @@ from .models import blueprint_models
16
16
  routes = flask.Blueprint("routes", __name__, url_prefix="/opengeodeweb_back")
17
17
 
18
18
 
19
- @routes.before_request
20
- def before_request():
21
- if "ping" not in flask.request.path:
22
- utils_functions.increment_request_counter(flask.current_app)
23
-
24
-
25
- @routes.teardown_request
26
- def teardown_request(exception):
27
-
28
- if "ping" not in flask.request.path:
29
- utils_functions.decrement_request_counter(flask.current_app)
30
- utils_functions.update_last_request_time(flask.current_app)
31
-
32
-
33
19
  routes.register_blueprint(
34
20
  blueprint_models.routes,
35
21
  url_prefix=blueprint_models.routes.url_prefix,
@@ -41,13 +41,28 @@ def update_last_request_time(current_app: flask.Flask) -> None:
41
41
  current_app.config.update(LAST_REQUEST_TIME=LAST_REQUEST_TIME)
42
42
 
43
43
 
44
+ def terminate_session(exception: BaseException | None) -> None:
45
+ session = flask.g.pop("session", None)
46
+ if session is None:
47
+ return
48
+ if exception is None:
49
+ session.commit()
50
+ else:
51
+ session.rollback()
52
+ session.close()
53
+
54
+
44
55
  def before_request(current_app: flask.Flask) -> None:
45
56
  increment_request_counter(current_app)
57
+ flask.g.session = get_session()
46
58
 
47
59
 
48
- def teardown_request(current_app: flask.Flask) -> None:
60
+ def teardown_request(
61
+ current_app: flask.Flask, exception: BaseException | None = None
62
+ ) -> None:
49
63
  decrement_request_counter(current_app)
50
64
  update_last_request_time(current_app)
65
+ terminate_session(exception)
51
66
 
52
67
 
53
68
  def kill_task(current_app: flask.Flask) -> None:
@@ -202,10 +217,6 @@ def save_all_viewables_and_return_info(
202
217
  data_entry.viewable_file_name = os.path.basename(saved_viewable_file_path)
203
218
  data_entry.light_viewable = os.path.basename(saved_light_viewable_file_path)
204
219
 
205
- session = get_session()
206
- if session:
207
- session.commit()
208
-
209
220
  return {
210
221
  "native_file_name": data_entry.native_file_name,
211
222
  "viewable_file_name": data_entry.viewable_file_name,
@@ -213,7 +224,7 @@ def save_all_viewables_and_return_info(
213
224
  "object_type": geode_functions.get_object_type(geode_object),
214
225
  "binary_light_viewable": binary_light_viewable.decode("utf-8"),
215
226
  "geode_object": data_entry.geode_object,
216
- "input_files": data_entry.input_file,
227
+ "input_file": data_entry.input_file,
217
228
  "additional_files": data_entry.additional_files,
218
229
  }
219
230
 
@@ -228,7 +239,6 @@ def generate_native_viewable_and_light_viewable_from_file(
228
239
  geode_object: str, input_filename: str
229
240
  ) -> dict[str, Any]:
230
241
 
231
- session = get_session()
232
242
  temp_data_entry = Data.create(
233
243
  geode_object=geode_object,
234
244
  input_file=input_filename,
@@ -260,11 +270,6 @@ def generate_native_viewable_and_light_viewable_from_file(
260
270
 
261
271
  data = geode_functions.load(geode_object, copied_full_path)
262
272
 
263
- if session:
264
- session.delete(temp_data_entry)
265
- session.flush()
266
- session.commit()
267
-
268
273
  return save_all_viewables_and_return_info(
269
274
  geode_object,
270
275
  data,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OpenGeodeWeb-Back
3
- Version: 5.10.3rc18
3
+ Version: 5.10.4rc2
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
@@ -27,7 +27,7 @@ Requires-Dist: opengeode-geosciencesio==5.8.0
27
27
  Requires-Dist: opengeode-inspector==6.8.1
28
28
  Requires-Dist: opengeode-io==7.4.0
29
29
  Requires-Dist: werkzeug==3.1.2
30
- Requires-Dist: opengeodeweb-microservice==1.*,>=1.0.4rc9
30
+ Requires-Dist: opengeodeweb-microservice==1.*,>=1.0.4
31
31
  Dynamic: license-file
32
32
 
33
33
  <h1 align="center">OpenGeodeWeb-Back<sup><i>by Geode-solutions</i></sup></h1>
@@ -1,12 +1,12 @@
1
1
  opengeodeweb_back/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- opengeodeweb_back/app.py,sha256=7sacDhOn73S4SBACvwvHonS5pOeu4ttuxrg32FRHlPQ,4509
2
+ opengeodeweb_back/app.py,sha256=_ws9UCqbR-_Hd4kE-Xh7FaGSulVRd7Au3KbOM3GUQ8I,4766
3
3
  opengeodeweb_back/app_config.py,sha256=z-omTiGj3-y0BZ1IchAM6EoTdC7vAX6B4OymEnuM0T4,843
4
4
  opengeodeweb_back/geode_functions.py,sha256=NzELy9s6AETDnm7tyA_uM2N89zrfeLdblRhzYrBONmw,10804
5
5
  opengeodeweb_back/geode_objects.py,sha256=_NclGPa024kCwUHdORkFuXYtiZBmQpgq6sO3LRkBhe8,27776
6
6
  opengeodeweb_back/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
7
7
  opengeodeweb_back/test_utils.py,sha256=18AbRW9-tfKkPcmRGilTTHXI7S3armYyV7Vdy5UvUKM,794
8
- opengeodeweb_back/utils_functions.py,sha256=rGxBhz_t6JJ7eEi4PZS0b3SyGBFRCohZN5e3DQscpeQ,9111
9
- opengeodeweb_back/routes/blueprint_routes.py,sha256=19W90mI3-jL80prgOU3aq8mBp3TM5-TO1rg244eZg2k,11394
8
+ opengeodeweb_back/utils_functions.py,sha256=iOOOccpxgjNS4KriwcG2VYDuYF6kAU0r297uXN00OSk,9265
9
+ opengeodeweb_back/routes/blueprint_routes.py,sha256=eTEKwKt9qc6cH1MDQ3lwmcnzLLxU_W8cYwu8HcUbXxo,10998
10
10
  opengeodeweb_back/routes/models/blueprint_models.py,sha256=Jo9pUDeu1nO3_IbBiuHGk57cc4_fhwxjM0EKNyv1FT0,1874
11
11
  opengeodeweb_back/routes/models/schemas/mesh_components.json,sha256=JmQUvpy7HpGS6FlThZLx1YjHqiInRTqUZ_Ft5MfOzEE,239
12
12
  opengeodeweb_back/routes/models/schemas/vtm_component_indices.json,sha256=0XILVxhAxi0RhQFDZZoUeGcAnBMroWz3kNJS7-6_dKQ,239
@@ -25,9 +25,9 @@ opengeodeweb_back/routes/schemas/save_viewable_file.json,sha256=pvvEdaC7bNASPMrl
25
25
  opengeodeweb_back/routes/schemas/texture_coordinates.json,sha256=2uQueIl1jOmxFG_gIi_vJETR4IurrwuSf8GAnzphk9g,237
26
26
  opengeodeweb_back/routes/schemas/upload_file.json,sha256=LJ3U3L5ApKuQDVFIpVT_y2alq4HW_suTvZ3HUucNbhg,219
27
27
  opengeodeweb_back/routes/schemas/vertex_attribute_names.json,sha256=ECIflohiqPZNsflAdkfEzksL4we0JvZhIxUd84Ubctg,240
28
- opengeodeweb_back-5.10.3rc18.dist-info/licenses/LICENSE,sha256=LoTB-aqQvzTGxoTRXNnhNV0LKiqdk2bQv6MB34l8zkI,1079
29
- opengeodeweb_back-5.10.3rc18.dist-info/METADATA,sha256=GwLWaRCa9e4XfSLhINSE171V5M9HawDYAnNJYrvPRig,2669
30
- opengeodeweb_back-5.10.3rc18.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
31
- opengeodeweb_back-5.10.3rc18.dist-info/entry_points.txt,sha256=3W_t5GFc9ROHSIZ55IGvYU3DLHUFQmYOM4Bm9u3Z0cE,71
32
- opengeodeweb_back-5.10.3rc18.dist-info/top_level.txt,sha256=tN1FZeLIVBrdja2-pbmhg5-tK-JILmmT9OeIBnhlUrQ,18
33
- opengeodeweb_back-5.10.3rc18.dist-info/RECORD,,
28
+ opengeodeweb_back-5.10.4rc2.dist-info/licenses/LICENSE,sha256=LoTB-aqQvzTGxoTRXNnhNV0LKiqdk2bQv6MB34l8zkI,1079
29
+ opengeodeweb_back-5.10.4rc2.dist-info/METADATA,sha256=p903v6LSry-5lm4N7WTpAaUNTix732yhfdxRXHNGi-c,2665
30
+ opengeodeweb_back-5.10.4rc2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
31
+ opengeodeweb_back-5.10.4rc2.dist-info/entry_points.txt,sha256=3W_t5GFc9ROHSIZ55IGvYU3DLHUFQmYOM4Bm9u3Z0cE,71
32
+ opengeodeweb_back-5.10.4rc2.dist-info/top_level.txt,sha256=tN1FZeLIVBrdja2-pbmhg5-tK-JILmmT9OeIBnhlUrQ,18
33
+ opengeodeweb_back-5.10.4rc2.dist-info/RECORD,,