OpenGeodeWeb-Back 5.10.0rc10__py3-none-any.whl → 5.10.0rc12__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.
@@ -4,7 +4,9 @@ import time
4
4
 
5
5
  # Third party imports
6
6
  # Local application imports
7
- from .database import DATABASE_FILENAME
7
+ from opengeodeweb_microservice.database.connection import get_database
8
+
9
+ DATABASE_FILENAME = "project.db"
8
10
 
9
11
 
10
12
  class Config(object):
@@ -11,8 +11,8 @@ from typing import Any
11
11
  # Local application imports
12
12
  from .geode_objects import geode_objects_dict
13
13
  from . import utils_functions
14
- from .data import Data
15
- from .database import database
14
+ from opengeodeweb_microservice.database.data import Data
15
+ from opengeodeweb_microservice.database.connection import get_session
16
16
 
17
17
 
18
18
  def geode_object_value(geode_object: str):
@@ -61,12 +61,12 @@ def load_data(data_id: str) -> Any:
61
61
  flask.abort(404, f"Data with id {data_id} not found")
62
62
 
63
63
  file_absolute_path = data_file_path(data_id, data_entry.native_file_name)
64
+ print("Loading file: ", file_absolute_path)
65
+ print("File exists: ", os.path.exists(file_absolute_path))
64
66
  return load(data_entry.geode_object, file_absolute_path)
65
67
 
66
68
 
67
69
  def get_data_info(data_id: str) -> Data:
68
- from .data import Data
69
-
70
70
  data_entry = Data.get(data_id)
71
71
  if not data_entry:
72
72
  flask.abort(404, f"Data with id {data_id} not found")
@@ -0,0 +1 @@
1
+ partial
@@ -16,8 +16,8 @@ import werkzeug
16
16
 
17
17
  # Local application imports
18
18
  from . import geode_functions
19
- from .data import Data
20
- from .database import database
19
+ from opengeodeweb_microservice.database.data import Data
20
+ from opengeodeweb_microservice.database.connection import get_session
21
21
 
22
22
 
23
23
  def increment_request_counter(current_app: flask.Flask) -> None:
@@ -193,7 +193,9 @@ def save_all_viewables_and_return_info(
193
193
  data_entry.viewable_file_name = os.path.basename(saved_viewable_file_path)
194
194
  data_entry.light_viewable = os.path.basename(saved_light_viewable_file_path)
195
195
 
196
- database.session.commit()
196
+ session = get_session()
197
+ if session:
198
+ session.commit()
197
199
 
198
200
  return {
199
201
  "native_file_name": data_entry.native_file_name,
@@ -247,8 +249,14 @@ def generate_native_viewable_and_light_viewable_from_file(
247
249
 
248
250
  data = geode_functions.load(geode_object, copied_full_path)
249
251
 
250
- database.session.delete(temp_data_entry)
251
- database.session.flush()
252
+ # Remplacer :
253
+ # database.session.delete(temp_data_entry)
254
+ # database.session.flush()
255
+ # Par :
256
+ session = get_session()
257
+ if session:
258
+ session.delete(temp_data_entry)
259
+ session.flush()
252
260
 
253
261
  return save_all_viewables_and_return_info(
254
262
  geode_object,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OpenGeodeWeb-Back
3
- Version: 5.10.0rc10
3
+ Version: 5.10.0rc12
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
@@ -14,7 +14,7 @@ License-File: LICENSE
14
14
  Requires-Dist: asgiref==3.9.1
15
15
  Requires-Dist: blinker==1.9.0
16
16
  Requires-Dist: click==8.2.1
17
- Requires-Dist: fastjsonschema==2.16.2
17
+ Requires-Dist: fastjsonschema==2.21.1
18
18
  Requires-Dist: flask[async]==3.0.3
19
19
  Requires-Dist: flask-cors==6.0.1
20
20
  Requires-Dist: flask-sqlalchemy==3.1.1
@@ -29,6 +29,7 @@ Requires-Dist: opengeode-geosciences==9.2.2
29
29
  Requires-Dist: opengeode-geosciencesio==5.7.2
30
30
  Requires-Dist: opengeode-inspector==6.7.0
31
31
  Requires-Dist: opengeode-io==7.3.2
32
+ Requires-Dist: opengeodeweb-microservice==1.*,>=1.0.0
32
33
  Requires-Dist: sqlalchemy==2.0.43
33
34
  Requires-Dist: typing-extensions==4.15.0
34
35
  Requires-Dist: werkzeug==3.0.3
@@ -1,11 +1,10 @@
1
1
  opengeodeweb_back/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- opengeodeweb_back/app_config.py,sha256=XFl5KqrOWifVxdudiLm-LXmczYDBCbZtNboSYnNbLf8,1142
3
- opengeodeweb_back/data.py,sha256=wwLcWoYfPdE6jILnmkDQfkRJkMrHH9CB6VzPblrUgnk,1562
4
- opengeodeweb_back/database.py,sha256=lXbbJRZCdqLcQU-Xqi1jPmo8cIitbHOqUJW5uLBF85w,381
5
- opengeodeweb_back/geode_functions.py,sha256=uEWJSjlBpaJC4Qd5JPpiWiqLlCitb7peSMWzYRIVho8,10648
2
+ opengeodeweb_back/app_config.py,sha256=WH0f-J-cXgIU23wAhn-lujwqN2-htUw9nSWkrgyW5xc,1207
3
+ opengeodeweb_back/geode_functions.py,sha256=NzELy9s6AETDnm7tyA_uM2N89zrfeLdblRhzYrBONmw,10804
6
4
  opengeodeweb_back/geode_objects.py,sha256=_NclGPa024kCwUHdORkFuXYtiZBmQpgq6sO3LRkBhe8,27776
5
+ opengeodeweb_back/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
7
6
  opengeodeweb_back/test_utils.py,sha256=18AbRW9-tfKkPcmRGilTTHXI7S3armYyV7Vdy5UvUKM,794
8
- opengeodeweb_back/utils_functions.py,sha256=PclYunLMDVQn5s3V54v5jQ2zjtTFtH0C1m4niPOc2-0,8440
7
+ opengeodeweb_back/utils_functions.py,sha256=hqLDghUARAZSGPR8shXTOFXPauq_Z17HKBlIXUgJ1PI,8694
9
8
  opengeodeweb_back/routes/blueprint_routes.py,sha256=h_yfFC3ljH0KqFr5Ab_-IQYNB7VVRENwAMQk4NDsh18,11042
10
9
  opengeodeweb_back/routes/models/blueprint_models.py,sha256=Jo9pUDeu1nO3_IbBiuHGk57cc4_fhwxjM0EKNyv1FT0,1874
11
10
  opengeodeweb_back/routes/models/schemas/mesh_components.json,sha256=JmQUvpy7HpGS6FlThZLx1YjHqiInRTqUZ_Ft5MfOzEE,239
@@ -24,8 +23,8 @@ opengeodeweb_back/routes/schemas/save_viewable_file.json,sha256=pvvEdaC7bNASPMrl
24
23
  opengeodeweb_back/routes/schemas/texture_coordinates.json,sha256=2uQueIl1jOmxFG_gIi_vJETR4IurrwuSf8GAnzphk9g,237
25
24
  opengeodeweb_back/routes/schemas/upload_file.json,sha256=LJ3U3L5ApKuQDVFIpVT_y2alq4HW_suTvZ3HUucNbhg,219
26
25
  opengeodeweb_back/routes/schemas/vertex_attribute_names.json,sha256=ECIflohiqPZNsflAdkfEzksL4we0JvZhIxUd84Ubctg,240
27
- opengeodeweb_back-5.10.0rc10.dist-info/licenses/LICENSE,sha256=LoTB-aqQvzTGxoTRXNnhNV0LKiqdk2bQv6MB34l8zkI,1079
28
- opengeodeweb_back-5.10.0rc10.dist-info/METADATA,sha256=45XAIHH_6jDhQYI_zDliB3tfXk5WnZyVarolN4G5I9s,2822
29
- opengeodeweb_back-5.10.0rc10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
- opengeodeweb_back-5.10.0rc10.dist-info/top_level.txt,sha256=tN1FZeLIVBrdja2-pbmhg5-tK-JILmmT9OeIBnhlUrQ,18
31
- opengeodeweb_back-5.10.0rc10.dist-info/RECORD,,
26
+ opengeodeweb_back-5.10.0rc12.dist-info/licenses/LICENSE,sha256=LoTB-aqQvzTGxoTRXNnhNV0LKiqdk2bQv6MB34l8zkI,1079
27
+ opengeodeweb_back-5.10.0rc12.dist-info/METADATA,sha256=CDhWOj0l98z5nT5Tt6qYEyixJXnkd21OkFZigFkRftM,2876
28
+ opengeodeweb_back-5.10.0rc12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
+ opengeodeweb_back-5.10.0rc12.dist-info/top_level.txt,sha256=tN1FZeLIVBrdja2-pbmhg5-tK-JILmmT9OeIBnhlUrQ,18
30
+ opengeodeweb_back-5.10.0rc12.dist-info/RECORD,,
opengeodeweb_back/data.py DELETED
@@ -1,45 +0,0 @@
1
- from sqlalchemy import String, JSON
2
- from sqlalchemy.orm import Mapped, mapped_column
3
- from .database import database, Base
4
- import uuid
5
-
6
-
7
- class Data(Base):
8
- __tablename__ = "datas"
9
-
10
- id: Mapped[str] = mapped_column(
11
- String, primary_key=True, default=lambda: str(uuid.uuid4()).replace("-", "")
12
- )
13
- native_file_name: Mapped[str] = mapped_column(String, nullable=False)
14
- viewable_file_name: Mapped[str] = mapped_column(String, nullable=False)
15
- geode_object: Mapped[str] = mapped_column(String, nullable=False)
16
-
17
- light_viewable: Mapped[str | None] = mapped_column(String, nullable=True)
18
- input_file: Mapped[str | None] = mapped_column(String, nullable=True)
19
- additional_files: Mapped[list[str] | None] = mapped_column(JSON, nullable=True)
20
-
21
- @staticmethod
22
- def create(
23
- geode_object: str,
24
- input_file: str | None = None,
25
- additional_files: list[str] | None = None,
26
- ) -> "Data":
27
- input_file = input_file if input_file is not None else ""
28
- additional_files = additional_files if additional_files is not None else []
29
-
30
- data_entry = Data(
31
- geode_object=geode_object,
32
- input_file=input_file,
33
- additional_files=additional_files,
34
- native_file_name="",
35
- viewable_file_name="",
36
- light_viewable=None,
37
- )
38
-
39
- database.session.add(data_entry)
40
- database.session.flush()
41
- return data_entry
42
-
43
- @staticmethod
44
- def get(data_id: str) -> "Data | None":
45
- return database.session.get(Data, data_id)
@@ -1,19 +0,0 @@
1
- from flask import Flask
2
- from flask_sqlalchemy import SQLAlchemy
3
- from sqlalchemy.orm import DeclarativeBase
4
-
5
- DATABASE_FILENAME = "project.db"
6
-
7
-
8
- class Base(DeclarativeBase):
9
- pass
10
-
11
-
12
- database = SQLAlchemy(model_class=Base)
13
-
14
-
15
- def initialize_database(app: Flask) -> SQLAlchemy:
16
- database.init_app(app)
17
- with app.app_context():
18
- database.create_all()
19
- return database