OpenGeodeWeb-Back 7.2.0rc2__py3-none-any.whl → 7.2.0rc4__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.
@@ -187,7 +187,10 @@ def _query_proj_database(query: str, parameters: tuple[str, ...]) -> list[tuple[
187
187
  def area_of_use(authority: str, code: str) -> list[tuple[float, float, float, float]]:
188
188
  """Extents where PROJ declares the CRS usable, empty when unknown."""
189
189
  rows = _query_proj_database(AREA_OF_USE_QUERY, (authority, code)) or []
190
- return [(float(s), float(n), float(w), float(e)) for s, n, w, e in rows]
190
+ # Some extents of proj.db have no bounds: they say nothing about where the CRS is used
191
+ return [
192
+ (float(s), float(n), float(w), float(e)) for s, n, w, e in rows if None not in (s, n, w, e)
193
+ ]
191
194
 
192
195
 
193
196
  @functools.cache
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  # Standard library imports
4
4
  import base64
5
+ import contextlib
5
6
  import hashlib
6
7
  import logging
7
8
  import shutil
@@ -21,7 +22,10 @@ import fastjsonschema # type: ignore[import-untyped]
21
22
  import flask
22
23
  import opengeode as og
23
24
  from defusedxml.ElementTree import parse
24
- from opengeodeweb_microservice.database.connection import get_session
25
+ from opengeodeweb_microservice.database.connection import (
26
+ DatabaseNotInitializedError,
27
+ get_session,
28
+ )
25
29
  from opengeodeweb_microservice.database.data import Data
26
30
  from opengeodeweb_microservice.schemas import ErrorResponse, SchemaDict
27
31
 
@@ -68,19 +72,21 @@ def update_last_request_time(current_app: flask.Flask) -> None:
68
72
 
69
73
 
70
74
  def terminate_session(exception: BaseException | None) -> None:
71
- session = flask.g.pop("session", None)
72
- if session is None:
73
- return
74
- if exception is None:
75
- session.commit()
76
- else:
77
- session.rollback()
78
- session.close()
75
+ # The database is closed while import_project replaces the project files, and may be
76
+ # reopened during the request: the session to end is the one of the current database
77
+ with contextlib.suppress(DatabaseNotInitializedError):
78
+ session = get_session()
79
+ if exception is None:
80
+ session.commit()
81
+ else:
82
+ session.rollback()
83
+ session.close()
79
84
 
80
85
 
81
86
  def before_request(current_app: flask.Flask) -> None:
87
+ # No session here: requests that do not use the database (ping) must answer while
88
+ # import_project has it closed, the others fail on their own get_session()
82
89
  increment_request_counter(current_app)
83
- flask.g.session = get_session()
84
90
  flask.g.start_time = time.perf_counter()
85
91
 
86
92
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OpenGeodeWeb-Back
3
- Version: 7.2.0rc2
3
+ Version: 7.2.0rc4
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
@@ -7,7 +7,7 @@ opengeodeweb_back/schema_definitions.json,sha256=qrlTeX4IUkCE5fR_onzrXnBKz61YR-1
7
7
  opengeodeweb_back/schema_types.py,sha256=VcDIF2gpeWxTlarbyReCIBU97brdDLBmsNOF8uVdugs,1557
8
8
  opengeodeweb_back/test_utils.py,sha256=04Xcnlrgj1NS2UQH7ae7qDK_J85J3akZKvBNCI8LSVc,4407
9
9
  opengeodeweb_back/typed_route.py,sha256=XNNM9NUTdkydQce56BMGO_yu297g0Eq4BgAgtqzpvGA,3769
10
- opengeodeweb_back/utils_functions.py,sha256=rqZFTu4SYodiQKMR4pdN_XqB85TTGYDtDvbTdiqDCU8,23189
10
+ opengeodeweb_back/utils_functions.py,sha256=IYWd1-94ygMe8227IQhSV6fonOA8h-dR08Ae7_yXy5Y,23585
11
11
  opengeodeweb_back/basemap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  opengeodeweb_back/basemap/basemap_mesh.py,sha256=q4mT5v4RJW4RpvSpaQGcpw9qApjEP_y3AviRXtvdlhU,3649
13
13
  opengeodeweb_back/basemap/basemap_providers.py,sha256=X3lulG7zjY6S7teoaroLF108v0eJXO64vuXclsqsr2s,3575
@@ -15,7 +15,7 @@ opengeodeweb_back/basemap/basemap_tiles.py,sha256=50ax_WpPHBf2KegAkkumMwD3YSe2eZ
15
15
  opengeodeweb_back/crs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  opengeodeweb_back/crs/crs_alignment.py,sha256=sNTC0FECOI4mzigYLd7sI3VdCsZhF-Qgxo_0F-a9efo,4904
17
17
  opengeodeweb_back/crs/crs_assignment.py,sha256=Gmt-UT2QQTwxrVHwLpEkrVz6XUTh5cQM3GT-2OX03-Y,4773
18
- opengeodeweb_back/crs/crs_functions.py,sha256=CQ3vxgYURPfx6VGLwvlSxol5lDNXJUwTZybjkBaAuac,14263
18
+ opengeodeweb_back/crs/crs_functions.py,sha256=YmA36Tr42vnxQFnAAI4lZWkL9PyWMC5kWMNWNsXqGvE,14396
19
19
  opengeodeweb_back/geode_objects/__init__.py,sha256=4NCsyJ9bT2yW1ayklsYtVPY762kyKBexZWFrAm5p8fw,2912
20
20
  opengeodeweb_back/geode_objects/crs_coordinates.py,sha256=9ihhDQjO66E4hkbnCzCtdMSrSt_Xj4FXiLmN5YFQYH0,2360
21
21
  opengeodeweb_back/geode_objects/geode_brep.py,sha256=i3Pzrq5V9ePyh5vIdCXrNjAgwFBJ8GuO3GbRMmDRWQk,9067
@@ -156,9 +156,9 @@ opengeodeweb_back/routes/schemas/vertex_attribute_names.json,sha256=vBhRMTMEFlig
156
156
  opengeodeweb_back/routes/schemas/vertex_attribute_names.py,sha256=ALYxIKjTnMg2sw7TNdTCYc2lTmCMPO-s2WWJ4ENd0IQ,963
157
157
  opengeodeweb_back/routes/schemas/vertex_attribute_range.json,sha256=AfSQTSH7HsrqW-tBsJfNzuPns42OAvShMagvdXD6N5g,766
158
158
  opengeodeweb_back/routes/schemas/vertex_attribute_range.py,sha256=o62JCrRCdGH5_EC7_NuZffK0ef3nXtWhc4UqdzFGEBQ,1020
159
- opengeodeweb_back-7.2.0rc2.dist-info/licenses/LICENSE,sha256=LoTB-aqQvzTGxoTRXNnhNV0LKiqdk2bQv6MB34l8zkI,1079
160
- opengeodeweb_back-7.2.0rc2.dist-info/METADATA,sha256=51pBs9vVTb2245qgwH490OJlwaABr21c6lh390HmCzw,2905
161
- opengeodeweb_back-7.2.0rc2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
162
- opengeodeweb_back-7.2.0rc2.dist-info/entry_points.txt,sha256=zQdVlPLm17zhfFvqf1WdI7rFe-f-ruMt3UBBkCd3jcs,82
163
- opengeodeweb_back-7.2.0rc2.dist-info/top_level.txt,sha256=tN1FZeLIVBrdja2-pbmhg5-tK-JILmmT9OeIBnhlUrQ,18
164
- opengeodeweb_back-7.2.0rc2.dist-info/RECORD,,
159
+ opengeodeweb_back-7.2.0rc4.dist-info/licenses/LICENSE,sha256=LoTB-aqQvzTGxoTRXNnhNV0LKiqdk2bQv6MB34l8zkI,1079
160
+ opengeodeweb_back-7.2.0rc4.dist-info/METADATA,sha256=XQWoIa5_x5bu9rrQWf-fqyh4kQbpx0sBdsg83AJo-yY,2905
161
+ opengeodeweb_back-7.2.0rc4.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
162
+ opengeodeweb_back-7.2.0rc4.dist-info/entry_points.txt,sha256=zQdVlPLm17zhfFvqf1WdI7rFe-f-ruMt3UBBkCd3jcs,82
163
+ opengeodeweb_back-7.2.0rc4.dist-info/top_level.txt,sha256=tN1FZeLIVBrdja2-pbmhg5-tK-JILmmT9OeIBnhlUrQ,18
164
+ opengeodeweb_back-7.2.0rc4.dist-info/RECORD,,