c2cgeoportal-commons 2.8.1.146__py3-none-any.whl → 2.9.0.350__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.
- c2cgeoportal_commons/__init__.py +1 -1
- c2cgeoportal_commons/alembic/env.py +14 -10
- c2cgeoportal_commons/alembic/main/028477929d13_add_technical_roles.py +2 -2
- c2cgeoportal_commons/alembic/main/04f05bfbb05e_remove_the_old_is_expanded_column.py +3 -1
- c2cgeoportal_commons/alembic/main/116b9b79fc4d_internal_and_external_layer_tables_.py +12 -12
- c2cgeoportal_commons/alembic/main/1418cb05921b_merge_1_6_and_master_branches.py +3 -1
- c2cgeoportal_commons/alembic/main/164ac0819a61_add_image_format_to_wmts_layer.py +2 -2
- c2cgeoportal_commons/alembic/main/166ff2dcc48d_create_database.py +3 -3
- c2cgeoportal_commons/alembic/main/16e43f8c0330_remove_old_metadata_column.py +2 -2
- c2cgeoportal_commons/alembic/main/1d5d4abfebd1_add_restricted_theme.py +2 -2
- c2cgeoportal_commons/alembic/main/1de20166b274_remove_v1_artifacts.py +2 -2
- c2cgeoportal_commons/alembic/main/20137477bd02_update_icons_url.py +2 -2
- c2cgeoportal_commons/alembic/main/21f11066f8ec_trigger_on_role_updates_user_in_static.py +2 -2
- c2cgeoportal_commons/alembic/main/22e6dfb556de_add_description_tree_.py +2 -2
- c2cgeoportal_commons/alembic/main/29f2a32859ec_merge_1_6_and_master_branches.py +3 -1
- c2cgeoportal_commons/alembic/main/2b8ed8c1df94_set_layergroup_treeitem_is_as_a_primary_.py +2 -2
- c2cgeoportal_commons/alembic/main/2e57710fecfe_update_the_ogc_server_for_ogc_api.py +77 -0
- c2cgeoportal_commons/alembic/main/32527659d57b_move_exclude_properties_from_layerv1_to_.py +2 -2
- c2cgeoportal_commons/alembic/main/32b21aa1d0ed_merge_e004f76e951a_and_e004f76e951a_.py +3 -1
- c2cgeoportal_commons/alembic/main/338b57593823_remove_trigger_on_role_name_change.py +2 -2
- c2cgeoportal_commons/alembic/main/415746eb9f6_changes_for_v2.py +2 -2
- c2cgeoportal_commons/alembic/main/44c91d82d419_add_table_log.py +8 -6
- c2cgeoportal_commons/alembic/main/5109242131ce_add_column_time_widget.py +4 -3
- c2cgeoportal_commons/alembic/main/52916d8fde8b_add_sql_fields_to_vector_tiles.py +5 -3
- c2cgeoportal_commons/alembic/main/53ba1a68d5fe_add_theme_to_fulltextsearch.py +2 -2
- c2cgeoportal_commons/alembic/main/54645a535ad6_add_ordering_in_relation.py +2 -2
- c2cgeoportal_commons/alembic/main/56dc90838d90_fix_removing_layerv1.py +2 -2
- c2cgeoportal_commons/alembic/main/596ba21e3833_separate_local_internal.py +2 -2
- c2cgeoportal_commons/alembic/main/678f88c7ad5e_add_vector_tiles_layers_table.py +2 -2
- c2cgeoportal_commons/alembic/main/6a412d9437b1_rename_serverogc_to_ogcserver.py +2 -2
- c2cgeoportal_commons/alembic/main/6d87fdad275a_convert_metadata_to_the_right_case.py +2 -2
- c2cgeoportal_commons/alembic/main/7530011a66a7_trigger_on_role_updates_user_in_static.py +2 -2
- c2cgeoportal_commons/alembic/main/78fd093c8393_add_api_s_intrfaces.py +15 -10
- c2cgeoportal_commons/alembic/main/7d271f4527cd_add_layer_column_in_layerv1_table.py +2 -2
- c2cgeoportal_commons/alembic/main/809650bd04c3_add_dimension_field.py +2 -2
- c2cgeoportal_commons/alembic/main/8117bb9bba16_use_dimension_on_all_the_layers.py +2 -2
- c2cgeoportal_commons/alembic/main/87f8330ed64e_add_missing_delete_cascades.py +2 -2
- c2cgeoportal_commons/alembic/main/9268a1dffac0_add_trigger_to_be_able_to_correctly_.py +2 -2
- c2cgeoportal_commons/alembic/main/94db7e7e5b21_merge_2_2_and_master_branches.py +3 -1
- c2cgeoportal_commons/alembic/main/951ff84bd8ec_be_able_to_delete_a_wms_layer_in_sql.py +2 -2
- c2cgeoportal_commons/alembic/main/a00109812f89_add_field_layer_wms_valid.py +4 -4
- c2cgeoportal_commons/alembic/main/a4558f032d7d_add_support_of_cog_layers.py +74 -0
- c2cgeoportal_commons/alembic/main/a4f1aac9bda_merge_1_6_and_master_branches.py +3 -1
- c2cgeoportal_commons/alembic/main/b60f2a505f42_remame_uimetadata_to_metadata.py +2 -2
- c2cgeoportal_commons/alembic/main/b6b09f414fe8_sync_model_database.py +174 -0
- c2cgeoportal_commons/alembic/main/c75124553bf3_remove_deprecated_columns.py +2 -2
- c2cgeoportal_commons/alembic/main/d48a63b348f1_change_mapserver_url_for_docker.py +2 -2
- c2cgeoportal_commons/alembic/main/d8ef99bc227e_be_able_to_delete_a_linked_functionality.py +2 -2
- c2cgeoportal_commons/alembic/main/daf738d5bae4_merge_2_0_and_master_branches.py +3 -1
- c2cgeoportal_commons/alembic/main/dba87f2647f9_merge_2_2_on_2_3.py +3 -1
- c2cgeoportal_commons/alembic/main/e004f76e951a_add_missing_not_null.py +2 -2
- c2cgeoportal_commons/alembic/main/e7e03dedade3_put_the_default_wms_server_in_the_.py +2 -2
- c2cgeoportal_commons/alembic/main/e85afd327ab3_cascade_deletes_to_tsearch.py +2 -2
- c2cgeoportal_commons/alembic/main/ec82a8906649_add_missing_on_delete_cascade_on_layer_.py +2 -2
- c2cgeoportal_commons/alembic/main/ee25d267bf46_main_interface_desktop.py +2 -2
- c2cgeoportal_commons/alembic/main/eeb345672454_merge_2_4_and_master_branches.py +3 -1
- c2cgeoportal_commons/alembic/static/0c640a58a09a_add_opt_key_column.py +2 -2
- c2cgeoportal_commons/alembic/static/107b81f5b9fe_add_missing_delete_cascades.py +2 -2
- c2cgeoportal_commons/alembic/static/1857owc78a07_add_last_login_and_expiration_date.py +2 -2
- c2cgeoportal_commons/alembic/static/1da396a88908_move_user_table_to_static_schema.py +3 -3
- c2cgeoportal_commons/alembic/static/267b4c1bde2e_add_display_name_in_the_user_for_better_.py +62 -0
- c2cgeoportal_commons/alembic/static/3f89a7d71a5e_alter_column_url_to_remove_limitation.py +2 -2
- c2cgeoportal_commons/alembic/static/44c91d82d419_add_table_log.py +6 -4
- c2cgeoportal_commons/alembic/static/53d671b17b20_add_timezone_on_datetime_fields.py +2 -2
- c2cgeoportal_commons/alembic/static/5472fbc19f39_add_temp_password_column.py +2 -2
- c2cgeoportal_commons/alembic/static/76d72fb3fcb9_add_oauth2_pkce.py +3 -1
- c2cgeoportal_commons/alembic/static/7ef947f30f20_add_oauth2_tables.py +3 -1
- c2cgeoportal_commons/alembic/static/910b4ca53b68_sync_model_database.py +186 -0
- c2cgeoportal_commons/alembic/static/aa41e9613256_wip_add_openid_connect_support.py +64 -0
- c2cgeoportal_commons/alembic/static/ae5e88f35669_add_table_user_role.py +2 -2
- c2cgeoportal_commons/alembic/static/bd029dbfc11a_fill_tech_data_column.py +2 -2
- c2cgeoportal_commons/lib/email_.py +15 -19
- c2cgeoportal_commons/lib/literal.py +3 -3
- c2cgeoportal_commons/lib/url.py +15 -16
- c2cgeoportal_commons/lib/validators.py +1 -1
- c2cgeoportal_commons/models/__init__.py +15 -8
- c2cgeoportal_commons/models/main.py +323 -228
- c2cgeoportal_commons/models/sqlalchemy.py +11 -10
- c2cgeoportal_commons/models/static.py +125 -76
- c2cgeoportal_commons/testing/__init__.py +10 -6
- c2cgeoportal_commons/testing/initializedb.py +7 -6
- {c2cgeoportal_commons-2.8.1.146.dist-info → c2cgeoportal_commons-2.9.0.350.dist-info}/METADATA +4 -9
- c2cgeoportal_commons-2.9.0.350.dist-info/RECORD +89 -0
- {c2cgeoportal_commons-2.8.1.146.dist-info → c2cgeoportal_commons-2.9.0.350.dist-info}/WHEEL +1 -1
- tests/conftest.py +1 -1
- c2cgeoportal_commons-2.8.1.146.dist-info/RECORD +0 -83
- {c2cgeoportal_commons-2.8.1.146.dist-info → c2cgeoportal_commons-2.9.0.350.dist-info}/top_level.txt +0 -0
c2cgeoportal_commons/lib/url.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2013-
|
|
1
|
+
# Copyright (c) 2013-2025, Camptocamp SA
|
|
2
2
|
# All rights reserved.
|
|
3
3
|
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
|
@@ -28,11 +28,10 @@
|
|
|
28
28
|
import logging
|
|
29
29
|
import re
|
|
30
30
|
import urllib.parse
|
|
31
|
-
from typing import Dict, Optional, Set
|
|
32
31
|
|
|
33
32
|
from pyramid.request import Request
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
_LOG = logging.getLogger(__name__)
|
|
36
35
|
|
|
37
36
|
|
|
38
37
|
class Url:
|
|
@@ -40,13 +39,13 @@ class Url:
|
|
|
40
39
|
|
|
41
40
|
scheme = ""
|
|
42
41
|
_netloc = ""
|
|
43
|
-
_hostname:
|
|
44
|
-
_port:
|
|
42
|
+
_hostname: str | None = None
|
|
43
|
+
_port: int | None = None
|
|
45
44
|
path = ""
|
|
46
|
-
query:
|
|
45
|
+
query: dict[str, str] = {}
|
|
47
46
|
fragment = ""
|
|
48
47
|
|
|
49
|
-
def __init__(self, url:
|
|
48
|
+
def __init__(self, url: str | None = None):
|
|
50
49
|
if url:
|
|
51
50
|
url_split = urllib.parse.urlsplit(url)
|
|
52
51
|
self.scheme = url_split.scheme
|
|
@@ -55,7 +54,7 @@ class Url:
|
|
|
55
54
|
try:
|
|
56
55
|
self._port = url_split.port
|
|
57
56
|
except ValueError as error:
|
|
58
|
-
|
|
57
|
+
_LOG.debug(error)
|
|
59
58
|
self.path = url_split.path
|
|
60
59
|
self.query = dict(urllib.parse.parse_qsl(url_split.query))
|
|
61
60
|
self.fragment = url_split.fragment
|
|
@@ -94,7 +93,7 @@ class Url:
|
|
|
94
93
|
if len(netloc_split) == 2:
|
|
95
94
|
allowed = re.compile(r"^[0-9]+$")
|
|
96
95
|
if not allowed.match(netloc_split[1]):
|
|
97
|
-
|
|
96
|
+
_LOG.debug("The netloc '%s' contains invalid port", netloc)
|
|
98
97
|
self._port = None
|
|
99
98
|
else:
|
|
100
99
|
self._port = int(netloc_split[1])
|
|
@@ -104,7 +103,7 @@ class Url:
|
|
|
104
103
|
self._hostname = netloc_split[0]
|
|
105
104
|
|
|
106
105
|
@property
|
|
107
|
-
def hostname(self) ->
|
|
106
|
+
def hostname(self) -> str | None:
|
|
108
107
|
return self._hostname
|
|
109
108
|
|
|
110
109
|
@hostname.setter
|
|
@@ -115,15 +114,15 @@ class Url:
|
|
|
115
114
|
self.netloc = hostname if self._port is None else f"{hostname}:{self._port}"
|
|
116
115
|
|
|
117
116
|
@property
|
|
118
|
-
def port(self) ->
|
|
117
|
+
def port(self) -> int | None:
|
|
119
118
|
return self._port
|
|
120
119
|
|
|
121
120
|
@port.setter
|
|
122
|
-
def port(self, port:
|
|
121
|
+
def port(self, port: int | None) -> None:
|
|
123
122
|
self._port = port
|
|
124
123
|
self.netloc = (self._hostname or "") if port is None else f"{self._hostname}:{port}"
|
|
125
124
|
|
|
126
|
-
def add_query(self, query:
|
|
125
|
+
def add_query(self, query: dict[str, str], force: bool = False) -> "Url":
|
|
127
126
|
if query:
|
|
128
127
|
for key, value in query.items():
|
|
129
128
|
if force or key not in self.query:
|
|
@@ -131,7 +130,7 @@ class Url:
|
|
|
131
130
|
return self
|
|
132
131
|
|
|
133
132
|
@property
|
|
134
|
-
def query_lower(self) ->
|
|
133
|
+
def query_lower(self) -> dict[str, str]:
|
|
135
134
|
return {k.lower(): v for k, v in self.query.items()}
|
|
136
135
|
|
|
137
136
|
def url(self) -> str:
|
|
@@ -153,8 +152,8 @@ class Url:
|
|
|
153
152
|
|
|
154
153
|
|
|
155
154
|
def get_url2(
|
|
156
|
-
name: str, url: str, request: Request, errors:
|
|
157
|
-
) ->
|
|
155
|
+
name: str, url: str, request: Request, errors: set[str], servers: dict[str, str] | None = None
|
|
156
|
+
) -> Url | None:
|
|
158
157
|
"""
|
|
159
158
|
Get the real URL from the URI of the administration interface.
|
|
160
159
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2011-
|
|
1
|
+
# Copyright (c) 2011-2025, Camptocamp SA
|
|
2
2
|
# All rights reserved.
|
|
3
3
|
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
|
@@ -27,10 +27,11 @@
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
import logging
|
|
30
|
-
from typing import Any
|
|
30
|
+
from typing import Any
|
|
31
31
|
|
|
32
32
|
import sqlalchemy.ext.declarative
|
|
33
33
|
import sqlalchemy.orm
|
|
34
|
+
import sqlalchemy.orm.scoping
|
|
34
35
|
import zope.event
|
|
35
36
|
|
|
36
37
|
try:
|
|
@@ -42,19 +43,25 @@ except ModuleNotFoundError:
|
|
|
42
43
|
|
|
43
44
|
|
|
44
45
|
# Should be filed on application initialization
|
|
45
|
-
DBSession: sqlalchemy.orm.Session = None
|
|
46
|
-
Base: sqlalchemy.ext.declarative.ConcreteBase = sqlalchemy.ext.declarative.declarative_base()
|
|
47
|
-
DBSessions: Dict[str, sqlalchemy.orm.Session] = {}
|
|
46
|
+
DBSession: sqlalchemy.orm.scoping.scoped_session[sqlalchemy.orm.Session] | None = None
|
|
48
47
|
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
class BaseType(sqlalchemy.ext.declarative.DeclarativeMeta, type):
|
|
50
|
+
pass
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
Base: BaseType = sqlalchemy.orm.declarative_base()
|
|
54
|
+
DBSessions: dict[str, sqlalchemy.orm.scoping.scoped_session[sqlalchemy.orm.Session]] = {}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
_LOG = logging.getLogger(__name__)
|
|
51
58
|
|
|
52
59
|
|
|
53
60
|
class InvalidateCacheEvent:
|
|
54
61
|
"""Event to be broadcast."""
|
|
55
62
|
|
|
56
63
|
|
|
57
|
-
def cache_invalidate_cb(*args:
|
|
64
|
+
def cache_invalidate_cb(*args: list[Any]) -> None:
|
|
58
65
|
"""Invalidate the cache on a broadcast event."""
|
|
59
66
|
_cache_invalidate_cb()
|
|
60
67
|
|
|
@@ -67,4 +74,4 @@ try:
|
|
|
67
74
|
zope.event.notify(InvalidateCacheEvent())
|
|
68
75
|
|
|
69
76
|
except ModuleNotFoundError:
|
|
70
|
-
|
|
77
|
+
_LOG.error("c2cwsgiutils broadcast not found")
|