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.
Files changed (87) hide show
  1. c2cgeoportal_commons/__init__.py +1 -1
  2. c2cgeoportal_commons/alembic/env.py +14 -10
  3. c2cgeoportal_commons/alembic/main/028477929d13_add_technical_roles.py +2 -2
  4. c2cgeoportal_commons/alembic/main/04f05bfbb05e_remove_the_old_is_expanded_column.py +3 -1
  5. c2cgeoportal_commons/alembic/main/116b9b79fc4d_internal_and_external_layer_tables_.py +12 -12
  6. c2cgeoportal_commons/alembic/main/1418cb05921b_merge_1_6_and_master_branches.py +3 -1
  7. c2cgeoportal_commons/alembic/main/164ac0819a61_add_image_format_to_wmts_layer.py +2 -2
  8. c2cgeoportal_commons/alembic/main/166ff2dcc48d_create_database.py +3 -3
  9. c2cgeoportal_commons/alembic/main/16e43f8c0330_remove_old_metadata_column.py +2 -2
  10. c2cgeoportal_commons/alembic/main/1d5d4abfebd1_add_restricted_theme.py +2 -2
  11. c2cgeoportal_commons/alembic/main/1de20166b274_remove_v1_artifacts.py +2 -2
  12. c2cgeoportal_commons/alembic/main/20137477bd02_update_icons_url.py +2 -2
  13. c2cgeoportal_commons/alembic/main/21f11066f8ec_trigger_on_role_updates_user_in_static.py +2 -2
  14. c2cgeoportal_commons/alembic/main/22e6dfb556de_add_description_tree_.py +2 -2
  15. c2cgeoportal_commons/alembic/main/29f2a32859ec_merge_1_6_and_master_branches.py +3 -1
  16. c2cgeoportal_commons/alembic/main/2b8ed8c1df94_set_layergroup_treeitem_is_as_a_primary_.py +2 -2
  17. c2cgeoportal_commons/alembic/main/2e57710fecfe_update_the_ogc_server_for_ogc_api.py +77 -0
  18. c2cgeoportal_commons/alembic/main/32527659d57b_move_exclude_properties_from_layerv1_to_.py +2 -2
  19. c2cgeoportal_commons/alembic/main/32b21aa1d0ed_merge_e004f76e951a_and_e004f76e951a_.py +3 -1
  20. c2cgeoportal_commons/alembic/main/338b57593823_remove_trigger_on_role_name_change.py +2 -2
  21. c2cgeoportal_commons/alembic/main/415746eb9f6_changes_for_v2.py +2 -2
  22. c2cgeoportal_commons/alembic/main/44c91d82d419_add_table_log.py +8 -6
  23. c2cgeoportal_commons/alembic/main/5109242131ce_add_column_time_widget.py +4 -3
  24. c2cgeoportal_commons/alembic/main/52916d8fde8b_add_sql_fields_to_vector_tiles.py +5 -3
  25. c2cgeoportal_commons/alembic/main/53ba1a68d5fe_add_theme_to_fulltextsearch.py +2 -2
  26. c2cgeoportal_commons/alembic/main/54645a535ad6_add_ordering_in_relation.py +2 -2
  27. c2cgeoportal_commons/alembic/main/56dc90838d90_fix_removing_layerv1.py +2 -2
  28. c2cgeoportal_commons/alembic/main/596ba21e3833_separate_local_internal.py +2 -2
  29. c2cgeoportal_commons/alembic/main/678f88c7ad5e_add_vector_tiles_layers_table.py +2 -2
  30. c2cgeoportal_commons/alembic/main/6a412d9437b1_rename_serverogc_to_ogcserver.py +2 -2
  31. c2cgeoportal_commons/alembic/main/6d87fdad275a_convert_metadata_to_the_right_case.py +2 -2
  32. c2cgeoportal_commons/alembic/main/7530011a66a7_trigger_on_role_updates_user_in_static.py +2 -2
  33. c2cgeoportal_commons/alembic/main/78fd093c8393_add_api_s_intrfaces.py +15 -10
  34. c2cgeoportal_commons/alembic/main/7d271f4527cd_add_layer_column_in_layerv1_table.py +2 -2
  35. c2cgeoportal_commons/alembic/main/809650bd04c3_add_dimension_field.py +2 -2
  36. c2cgeoportal_commons/alembic/main/8117bb9bba16_use_dimension_on_all_the_layers.py +2 -2
  37. c2cgeoportal_commons/alembic/main/87f8330ed64e_add_missing_delete_cascades.py +2 -2
  38. c2cgeoportal_commons/alembic/main/9268a1dffac0_add_trigger_to_be_able_to_correctly_.py +2 -2
  39. c2cgeoportal_commons/alembic/main/94db7e7e5b21_merge_2_2_and_master_branches.py +3 -1
  40. c2cgeoportal_commons/alembic/main/951ff84bd8ec_be_able_to_delete_a_wms_layer_in_sql.py +2 -2
  41. c2cgeoportal_commons/alembic/main/a00109812f89_add_field_layer_wms_valid.py +4 -4
  42. c2cgeoportal_commons/alembic/main/a4558f032d7d_add_support_of_cog_layers.py +74 -0
  43. c2cgeoportal_commons/alembic/main/a4f1aac9bda_merge_1_6_and_master_branches.py +3 -1
  44. c2cgeoportal_commons/alembic/main/b60f2a505f42_remame_uimetadata_to_metadata.py +2 -2
  45. c2cgeoportal_commons/alembic/main/b6b09f414fe8_sync_model_database.py +174 -0
  46. c2cgeoportal_commons/alembic/main/c75124553bf3_remove_deprecated_columns.py +2 -2
  47. c2cgeoportal_commons/alembic/main/d48a63b348f1_change_mapserver_url_for_docker.py +2 -2
  48. c2cgeoportal_commons/alembic/main/d8ef99bc227e_be_able_to_delete_a_linked_functionality.py +2 -2
  49. c2cgeoportal_commons/alembic/main/daf738d5bae4_merge_2_0_and_master_branches.py +3 -1
  50. c2cgeoportal_commons/alembic/main/dba87f2647f9_merge_2_2_on_2_3.py +3 -1
  51. c2cgeoportal_commons/alembic/main/e004f76e951a_add_missing_not_null.py +2 -2
  52. c2cgeoportal_commons/alembic/main/e7e03dedade3_put_the_default_wms_server_in_the_.py +2 -2
  53. c2cgeoportal_commons/alembic/main/e85afd327ab3_cascade_deletes_to_tsearch.py +2 -2
  54. c2cgeoportal_commons/alembic/main/ec82a8906649_add_missing_on_delete_cascade_on_layer_.py +2 -2
  55. c2cgeoportal_commons/alembic/main/ee25d267bf46_main_interface_desktop.py +2 -2
  56. c2cgeoportal_commons/alembic/main/eeb345672454_merge_2_4_and_master_branches.py +3 -1
  57. c2cgeoportal_commons/alembic/static/0c640a58a09a_add_opt_key_column.py +2 -2
  58. c2cgeoportal_commons/alembic/static/107b81f5b9fe_add_missing_delete_cascades.py +2 -2
  59. c2cgeoportal_commons/alembic/static/1857owc78a07_add_last_login_and_expiration_date.py +2 -2
  60. c2cgeoportal_commons/alembic/static/1da396a88908_move_user_table_to_static_schema.py +3 -3
  61. c2cgeoportal_commons/alembic/static/267b4c1bde2e_add_display_name_in_the_user_for_better_.py +62 -0
  62. c2cgeoportal_commons/alembic/static/3f89a7d71a5e_alter_column_url_to_remove_limitation.py +2 -2
  63. c2cgeoportal_commons/alembic/static/44c91d82d419_add_table_log.py +6 -4
  64. c2cgeoportal_commons/alembic/static/53d671b17b20_add_timezone_on_datetime_fields.py +2 -2
  65. c2cgeoportal_commons/alembic/static/5472fbc19f39_add_temp_password_column.py +2 -2
  66. c2cgeoportal_commons/alembic/static/76d72fb3fcb9_add_oauth2_pkce.py +3 -1
  67. c2cgeoportal_commons/alembic/static/7ef947f30f20_add_oauth2_tables.py +3 -1
  68. c2cgeoportal_commons/alembic/static/910b4ca53b68_sync_model_database.py +186 -0
  69. c2cgeoportal_commons/alembic/static/aa41e9613256_wip_add_openid_connect_support.py +64 -0
  70. c2cgeoportal_commons/alembic/static/ae5e88f35669_add_table_user_role.py +2 -2
  71. c2cgeoportal_commons/alembic/static/bd029dbfc11a_fill_tech_data_column.py +2 -2
  72. c2cgeoportal_commons/lib/email_.py +15 -19
  73. c2cgeoportal_commons/lib/literal.py +3 -3
  74. c2cgeoportal_commons/lib/url.py +15 -16
  75. c2cgeoportal_commons/lib/validators.py +1 -1
  76. c2cgeoportal_commons/models/__init__.py +15 -8
  77. c2cgeoportal_commons/models/main.py +323 -228
  78. c2cgeoportal_commons/models/sqlalchemy.py +11 -10
  79. c2cgeoportal_commons/models/static.py +125 -76
  80. c2cgeoportal_commons/testing/__init__.py +10 -6
  81. c2cgeoportal_commons/testing/initializedb.py +7 -6
  82. {c2cgeoportal_commons-2.8.1.146.dist-info → c2cgeoportal_commons-2.9.0.350.dist-info}/METADATA +4 -9
  83. c2cgeoportal_commons-2.9.0.350.dist-info/RECORD +89 -0
  84. {c2cgeoportal_commons-2.8.1.146.dist-info → c2cgeoportal_commons-2.9.0.350.dist-info}/WHEEL +1 -1
  85. tests/conftest.py +1 -1
  86. c2cgeoportal_commons-2.8.1.146.dist-info/RECORD +0 -83
  87. {c2cgeoportal_commons-2.8.1.146.dist-info → c2cgeoportal_commons-2.9.0.350.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2013-2023, Camptocamp SA
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
- LOG = logging.getLogger(__name__)
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: Optional[str] = None
44
- _port: Optional[int] = None
42
+ _hostname: str | None = None
43
+ _port: int | None = None
45
44
  path = ""
46
- query: Dict[str, str] = {}
45
+ query: dict[str, str] = {}
47
46
  fragment = ""
48
47
 
49
- def __init__(self, url: Optional[str] = None):
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
- LOG.debug(error)
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
- LOG.debug("The netloc '%s' contains invalid port", netloc)
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) -> Optional[str]:
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) -> Optional[int]:
117
+ def port(self) -> int | None:
119
118
  return self._port
120
119
 
121
120
  @port.setter
122
- def port(self, port: Optional[int]) -> None:
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: Dict[str, str], force: bool = False) -> "Url":
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) -> Dict[str, str]:
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: Set[str], servers: Optional[Dict[str, str]] = None
157
- ) -> Optional[Url]:
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) 2019-2023, Camptocamp SA
1
+ # Copyright (c) 2019-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2011-2023, Camptocamp SA
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, Dict, List
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
- LOG = logging.getLogger(__name__)
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: List[Any]) -> None:
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
- LOG.error("c2cwsgiutils broadcast not found")
77
+ _LOG.error("c2cwsgiutils broadcast not found")