c2cgeoportal-commons 2.7.1.145__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 +18 -15
  3. c2cgeoportal_commons/alembic/main/028477929d13_add_technical_roles.py +3 -3
  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 +35 -39
  6. c2cgeoportal_commons/alembic/main/1418cb05921b_merge_1_6_and_master_branches.py +2 -4
  7. c2cgeoportal_commons/alembic/main/164ac0819a61_add_image_format_to_wmts_layer.py +2 -2
  8. c2cgeoportal_commons/alembic/main/166ff2dcc48d_create_database.py +5 -5
  9. c2cgeoportal_commons/alembic/main/16e43f8c0330_remove_old_metadata_column.py +2 -2
  10. c2cgeoportal_commons/alembic/main/1d5d4abfebd1_add_restricted_theme.py +3 -3
  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 +14 -16
  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 +2 -4
  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 +8 -8
  19. c2cgeoportal_commons/alembic/main/32b21aa1d0ed_merge_e004f76e951a_and_e004f76e951a_.py +2 -4
  20. c2cgeoportal_commons/alembic/main/338b57593823_remove_trigger_on_role_name_change.py +16 -18
  21. c2cgeoportal_commons/alembic/main/415746eb9f6_changes_for_v2.py +31 -31
  22. c2cgeoportal_commons/alembic/main/44c91d82d419_add_table_log.py +72 -0
  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 +10 -10
  27. c2cgeoportal_commons/alembic/main/56dc90838d90_fix_removing_layerv1.py +2 -2
  28. c2cgeoportal_commons/alembic/main/596ba21e3833_separate_local_internal.py +6 -10
  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 +4 -4
  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 +14 -16
  33. c2cgeoportal_commons/alembic/main/78fd093c8393_add_api_s_intrfaces.py +30 -49
  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 +4 -4
  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 +2 -4
  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 +2 -4
  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 +6 -10
  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 +2 -4
  50. c2cgeoportal_commons/alembic/main/dba87f2647f9_merge_2_2_on_2_3.py +2 -4
  51. c2cgeoportal_commons/alembic/main/e004f76e951a_add_missing_not_null.py +6 -22
  52. c2cgeoportal_commons/alembic/main/e7e03dedade3_put_the_default_wms_server_in_the_.py +6 -10
  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 +4 -10
  56. c2cgeoportal_commons/alembic/main/eeb345672454_merge_2_4_and_master_branches.py +2 -4
  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 +6 -10
  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 +72 -0
  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 +70 -0
  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 +8 -14
  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 -3
  76. c2cgeoportal_commons/models/__init__.py +16 -9
  77. c2cgeoportal_commons/models/main.py +415 -226
  78. c2cgeoportal_commons/models/sqlalchemy.py +13 -13
  79. c2cgeoportal_commons/models/static.py +162 -71
  80. c2cgeoportal_commons/testing/__init__.py +12 -7
  81. c2cgeoportal_commons/testing/initializedb.py +7 -6
  82. {c2cgeoportal_commons-2.7.1.145.dist-info → c2cgeoportal_commons-2.9.0.350.dist-info}/METADATA +4 -5
  83. c2cgeoportal_commons-2.9.0.350.dist-info/RECORD +89 -0
  84. {c2cgeoportal_commons-2.7.1.145.dist-info → c2cgeoportal_commons-2.9.0.350.dist-info}/WHEEL +1 -1
  85. tests/conftest.py +1 -1
  86. c2cgeoportal_commons-2.7.1.145.dist-info/RECORD +0 -80
  87. {c2cgeoportal_commons-2.7.1.145.dist-info → c2cgeoportal_commons-2.9.0.350.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2011-2021, 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
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2014-2019, Camptocamp SA
1
+ # Copyright (c) 2014-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -29,16 +29,15 @@
29
29
  # pylint: disable=no-member
30
30
 
31
31
  import logging.config
32
- from typing import Any, Dict, Union, cast
32
+ from typing import Any, cast
33
33
 
34
- import c2cwsgiutils.pyramid_logging
35
34
  import sqlalchemy
36
35
  from alembic import context
37
36
  from c2c.template.config import config
38
37
  from plaster.loaders import setup_logging
39
38
  from sqlalchemy import engine_from_config, pool
40
39
 
41
- LOG = logging.getLogger(__name__)
40
+ _LOG = logging.getLogger(__name__)
42
41
 
43
42
 
44
43
  # Interpret the config file for Python logging.
@@ -46,13 +45,18 @@ LOG = logging.getLogger(__name__)
46
45
  setup_logging(context.config.config_file_name)
47
46
 
48
47
 
49
- def get_config() -> Dict[str, Union[str, bool]]:
48
+ def get_config() -> dict[str, str | bool]:
50
49
  """Get the application configuration."""
51
- config.init(context.config.get_main_option("app.cfg"))
52
- settings: Dict[str, Union[str, bool]] = {}
53
- settings.update(config.get_config())
50
+ app_cfg = context.config.get_main_option("app.cfg")
51
+ assert app_cfg is not None
52
+ config.init(app_cfg)
53
+ conf = config.get_config()
54
+ assert conf is not None
55
+ settings: dict[str, str | bool] = {}
56
+ settings.update(conf)
54
57
  alembic_name = context.config.get_main_option("type")
55
- schema_config_name = "schema{}".format(f"_{alembic_name}" if alembic_name != "main" else "")
58
+ schema_postfix = f"_{alembic_name}" if alembic_name != "main" else ""
59
+ schema_config_name = f"schema{schema_postfix}"
56
60
  script_location = context.config.get_main_option("script_location")
57
61
  version_table = context.config.get_main_option("version_table")
58
62
  version_locations = context.config.get_main_option("version_locations")
@@ -95,13 +99,13 @@ def run_migrations_online() -> None:
95
99
 
96
100
  In this scenario we need to create an Engine and associate a connection with the context.
97
101
  """
98
- conf: Dict[str, Any] = get_config()
102
+ conf: dict[str, Any] = get_config()
99
103
 
100
104
  # Autogenerate config
101
105
  alembic_name = context.config.get_main_option("type")
102
- from c2cgeoportal_commons.models import Base, main, static
106
+ from c2cgeoportal_commons.models import Base, main, static # pylint: disable=import-outside-toplevel
103
107
 
104
- _schema = main._schema if alembic_name == "main" else static._schema
108
+ _schema = main._schema if alembic_name == "main" else static._schema # pylint: disable=protected-access
105
109
 
106
110
  def include_object(
107
111
  obj: sqlalchemy.ext.declarative.ConcreteBase,
@@ -113,9 +117,8 @@ def run_migrations_online() -> None:
113
117
  del name, reflected, compare_to
114
118
 
115
119
  if type_ == "table":
116
- return cast(bool, obj.schema == _schema)
117
- else:
118
- return cast(bool, obj.table.schema == _schema)
120
+ return cast(bool, obj.schema == _schema) # type: ignore[attr-defined]
121
+ return cast(bool, obj.table.schema == _schema) # type: ignore[attr-defined]
119
122
 
120
123
  if _schema:
121
124
  conf.update(
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2021, 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
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Add technical roles.
@@ -70,4 +70,4 @@ def downgrade() -> None:
70
70
  schema = config["schema"]
71
71
 
72
72
  for name in ("anonymous", "registered", "intranet"):
73
- op.execute('DELETE FROM {schema}."role" ' "WHERE name = '{name}'".format(name=name, schema=schema))
73
+ op.execute(f"DELETE FROM {schema}.\"role\" WHERE name = '{name}'")
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020-2021, Camptocamp SA
1
+ # Copyright (c) 2020-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,6 +25,8 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
+ # pylint: disable=invalid-name
29
+
28
30
  """
29
31
  Remove the old is_expanded column.
30
32
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2015-2019, Camptocamp SA
1
+ # Copyright (c) 2015-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  internal and external layer tables refactoring, new ogc table.
@@ -86,7 +86,7 @@ def upgrade() -> None:
86
86
 
87
87
  # default 'image/jpeg', 'image/png'
88
88
  op.execute(
89
- "INSERT INTO %(schema)s.server_ogc (name, description, type, image_type, "
89
+ f"INSERT INTO {schema}.server_ogc (name, description, type, image_type, "
90
90
  " auth, wfs_support) "
91
91
  "SELECT 'source for ' || image_type AS name, "
92
92
  " 'default source for internal ' || image_type AS description, "
@@ -96,11 +96,11 @@ def upgrade() -> None:
96
96
  " 'true' AS wfs_support "
97
97
  "FROM ("
98
98
  " SELECT UNNEST(ARRAY['image/jpeg', 'image/png']) AS image_type"
99
- ") AS foo" % {"schema": schema}
99
+ ") AS foo"
100
100
  )
101
101
  # other custom image types
102
102
  op.execute(
103
- "INSERT INTO %(schema)s.server_ogc (name, description, type, image_type, "
103
+ f"INSERT INTO {schema}.server_ogc (name, description, type, image_type, "
104
104
  " auth, wfs_support) "
105
105
  "SELECT 'source for ' || image_type AS name, "
106
106
  " 'default source for internal ' || image_type AS description, "
@@ -109,57 +109,53 @@ def upgrade() -> None:
109
109
  " 'Standard auth' AS auth, "
110
110
  " 'true' AS wfs_support "
111
111
  "FROM ("
112
- " SELECT DISTINCT(image_type) FROM %(schema)s.layer_internal_wms "
112
+ f" SELECT DISTINCT(image_type) FROM {schema}.layer_internal_wms "
113
113
  " WHERE image_type NOT IN ('image/jpeg', 'image/png')"
114
- ") as foo" % {"schema": schema}
114
+ ") as foo"
115
115
  )
116
116
 
117
117
  # layers for internal
118
118
 
119
119
  # internal with not null image_type
120
120
  op.execute(
121
- "INSERT INTO %(schema)s.layer_wms (id, server_ogc_id, layer, style, "
121
+ f"INSERT INTO {schema}.layer_wms (id, server_ogc_id, layer, style, "
122
122
  " time_mode, time_widget) "
123
- "SELECT lew.id, so.id, layer, style, time_mode, time_widget "
124
- "FROM %(schema)s.layer_internal_wms AS lew, %(schema)s.server_ogc AS so "
125
- "WHERE lew.image_type=so.image_type AND so.type IS NOT NULL" % {"schema": schema}
123
+ "SELECT layer.id, so.id, layer, style, time_mode, time_widget "
124
+ f"FROM {schema}.layer_internal_wms AS layer, {schema}.server_ogc AS so "
125
+ "WHERE layer.image_type=so.image_type AND so.type IS NOT NULL"
126
126
  )
127
127
  # internal with null image_type
128
128
  op.execute(
129
- "INSERT INTO %(schema)s.layer_wms (id, server_ogc_id, layer, style, "
129
+ f"INSERT INTO {schema}.layer_wms (id, server_ogc_id, layer, style, "
130
130
  " time_mode, time_widget) "
131
- "SELECT lew.id, so.id, layer, style, time_mode, time_widget "
132
- "FROM %(schema)s.layer_internal_wms AS lew, %(schema)s.server_ogc AS so "
133
- "WHERE lew.image_type IS NULL AND so.image_type='image/png'" % {"schema": schema}
131
+ "SELECT layer.id, so.id, layer, style, time_mode, time_widget "
132
+ f"FROM {schema}.layer_internal_wms AS layer, {schema}.server_ogc AS so "
133
+ "WHERE layer.image_type IS NULL AND so.image_type='image/png'"
134
134
  )
135
135
 
136
136
  # ocg for externals
137
137
  op.execute(
138
- "INSERT INTO %(schema)s.server_ogc (name, url, type, image_type, auth, is_single_tile) "
138
+ f"INSERT INTO {schema}.server_ogc (name, url, type, image_type, auth, is_single_tile) "
139
139
  "SELECT 'source for ' || url, url, 'mapserver' AS type, image_type, 'none', CASE "
140
140
  "WHEN is_single_tile IS TRUE THEN TRUE ELSE FALSE END as is_single_tile "
141
- "FROM %(schema)s.layer_external_wms GROUP BY url, image_type, is_single_tile" % {"schema": schema}
141
+ f"FROM {schema}.layer_external_wms GROUP BY url, image_type, is_single_tile"
142
142
  )
143
143
 
144
144
  # layers for external
145
145
  op.execute(
146
- "INSERT INTO %(schema)s.layer_wms (id, server_ogc_id, layer, style, "
146
+ f"INSERT INTO {schema}.layer_wms (id, server_ogc_id, layer, style, "
147
147
  " time_mode, time_widget) "
148
- "SELECT lew.id, so.id, layer, style, time_mode, time_widget "
149
- "FROM %(schema)s.layer_external_wms as lew, %(schema)s.server_ogc as so "
150
- "WHERE lew.url=so.url AND lew.is_single_tile=so.is_single_tile "
151
- "AND lew.image_type=so.image_type" % {"schema": schema}
148
+ "SELECT layer.id, so.id, layer, style, time_mode, time_widget "
149
+ f"FROM {schema}.layer_external_wms as layer, {schema}.server_ogc as so "
150
+ "WHERE layer.url=so.url AND layer.is_single_tile=so.is_single_tile "
151
+ "AND layer.image_type=so.image_type"
152
152
  )
153
153
 
154
154
  op.drop_table("layer_external_wms", schema=schema)
155
155
  op.drop_table("layer_internal_wms", schema=schema)
156
156
 
157
157
  # update layer type in treeitems
158
- op.execute(
159
- "UPDATE %(schema)s.treeitem "
160
- "SET type='l_wms' "
161
- "WHERE type='l_int_wms' OR type='l_ext_wms'" % {"schema": schema}
162
- )
158
+ op.execute(f"UPDATE {schema}.treeitem " "SET type='l_wms' " "WHERE type='l_int_wms' OR type='l_ext_wms'")
163
159
 
164
160
 
165
161
  def downgrade() -> None:
@@ -196,20 +192,20 @@ def downgrade() -> None:
196
192
 
197
193
  # internal (type is not null)
198
194
  op.execute(
199
- "INSERT INTO %(schema)s.layer_internal_wms (id, layer, image_type, style, "
195
+ f"INSERT INTO {schema}.layer_internal_wms (id, layer, image_type, style, "
200
196
  " time_mode, time_widget) "
201
197
  "SELECT w.id, layer, image_type, style, time_mode, time_widget "
202
- "FROM %(schema)s.layer_wms AS w, %(schema)s.server_ogc AS o "
203
- "WHERE w.server_ogc_id=o.id AND o.type IS NOT NULL" % {"schema": schema}
198
+ f"FROM {schema}.layer_wms AS w, {schema}.server_ogc AS o "
199
+ "WHERE w.server_ogc_id=o.id AND o.type IS NOT NULL"
204
200
  )
205
201
 
206
202
  # external (type is null)
207
203
  op.execute(
208
- "INSERT INTO %(schema)s.layer_external_wms (id, url, layer, image_type, style, "
204
+ f"INSERT INTO {schema}.layer_external_wms (id, url, layer, image_type, style, "
209
205
  " is_single_tile, time_mode, time_widget) "
210
206
  "SELECT w.id, url, layer, image_type, style, is_single_tile, time_mode, time_widget "
211
- "FROM %(schema)s.layer_wms AS w, %(schema)s.server_ogc AS o "
212
- "WHERE w.server_ogc_id=o.id AND o.type IS NULL" % {"schema": schema}
207
+ f"FROM {schema}.layer_wms AS w, {schema}.server_ogc AS o "
208
+ "WHERE w.server_ogc_id=o.id AND o.type IS NULL"
213
209
  )
214
210
 
215
211
  # drop table AFTER moving data back
@@ -219,15 +215,15 @@ def downgrade() -> None:
219
215
  # update layer type in treeitems
220
216
  # internal
221
217
  op.execute(
222
- "UPDATE %(schema)s.treeitem "
218
+ f"UPDATE {schema}.treeitem "
223
219
  "SET type='l_int_wms' "
224
- "FROM %(schema)s.layer_internal_wms as w "
225
- "WHERE %(schema)s.treeitem.id=w.id" % {"schema": schema}
220
+ f"FROM {schema}.layer_internal_wms as w "
221
+ f"WHERE {schema}.treeitem.id=w.id"
226
222
  )
227
223
  # external
228
224
  op.execute(
229
- "UPDATE %(schema)s.treeitem "
225
+ f"UPDATE {schema}.treeitem "
230
226
  "SET type='l_ext_wms' "
231
- "FROM %(schema)s.layer_external_wms as w "
232
- "WHERE %(schema)s.treeitem.id=w.id" % {"schema": schema}
227
+ f"FROM {schema}.layer_external_wms as w "
228
+ f"WHERE {schema}.treeitem.id=w.id"
233
229
  )
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2015-2019, Camptocamp SA
1
+ # Copyright (c) 2015-2025, Camptocamp SA
4
2
  # All rights reserved.
5
3
 
6
4
  # Redistribution and use in source and binary forms, with or without
@@ -27,7 +25,7 @@
27
25
  # of the authors and should not be interpreted as representing official policies,
28
26
  # either expressed or implied, of the FreeBSD Project.
29
27
 
30
- # pylint: disable=no-member
28
+ # pylint: disable=invalid-name
31
29
 
32
30
  """
33
31
  Merge 1.6 and master branches.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2015-2019, Camptocamp SA
1
+ # Copyright (c) 2015-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Add image format to WMTS layer.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2014-2019, Camptocamp SA
1
+ # Copyright (c) 2014-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  create database.
@@ -47,10 +47,10 @@ revision = "166ff2dcc48d"
47
47
  down_revision = None
48
48
 
49
49
 
50
- class TsVector(UserDefinedType): # type: ignore
50
+ class TsVector(UserDefinedType): # type: ignore # pylint: disable=abstract-method
51
51
  """A custom type for PostgreSQL's tsvector type."""
52
52
 
53
- def get_col_spec(self) -> str:
53
+ def get_col_spec(self) -> str: # type: ignore[override] # pylint: disable=arguments-differ
54
54
  return "TSVECTOR"
55
55
 
56
56
 
@@ -63,7 +63,7 @@ def upgrade() -> None:
63
63
 
64
64
  engine = op.get_bind().engine
65
65
  with engine.connect() as connection:
66
- if type(engine).__name__ != "MockConnection" and op.get_context().dialect.has_table( # type: ignore
66
+ if type(engine).__name__ != "MockConnection" and op.get_context().dialect.has_table(
67
67
  connection, "functionality", schema=schema
68
68
  ):
69
69
  return
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2021, 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
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Remove old metadata column.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2014-2019, Camptocamp SA
1
+ # Copyright (c) 2014-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Add restricted theme.
@@ -51,7 +51,7 @@ def upgrade() -> None:
51
51
 
52
52
  engine = op.get_bind().engine
53
53
  with engine.connect() as connection:
54
- if type(engine).__name__ != "MockConnection" and op.get_context().dialect.has_table( # type: ignore
54
+ if type(engine).__name__ != "MockConnection" and op.get_context().dialect.has_table(
55
55
  connection, "restricted_role_theme", schema=schema
56
56
  ):
57
57
  return
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2019-2021, 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
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Remove v1 artifacts.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2014-2019, Camptocamp SA
1
+ # Copyright (c) 2014-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Update icons url.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2018-2019, Camptocamp SA
1
+ # Copyright (c) 2018-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  trigger_on_role_updates_user_in_static.
@@ -51,20 +51,18 @@ def upgrade() -> None:
51
51
  staticschema = config["schema_static"]
52
52
 
53
53
  op.execute(
54
- """
55
- CREATE OR REPLACE FUNCTION {schema}.on_role_name_change()
56
- RETURNS trigger AS
57
- $$
58
- BEGIN
59
- IF NEW.name <> OLD.name THEN
60
- UPDATE {staticschema}."user" SET role_name = NEW.name WHERE role_name = OLD.name;
61
- END IF;
62
- RETURN NEW;
63
- END;
64
- $$
65
- LANGUAGE plpgsql""".format(
66
- schema=schema, staticschema=staticschema
67
- )
54
+ f"""
55
+ CREATE OR REPLACE FUNCTION {schema}.on_role_name_change()
56
+ RETURNS trigger AS
57
+ $$
58
+ BEGIN
59
+ IF NEW.name <> OLD.name THEN
60
+ UPDATE {staticschema}."user" SET role_name = NEW.name WHERE role_name = OLD.name;
61
+ END IF;
62
+ RETURN NEW;
63
+ END;
64
+ $$
65
+ LANGUAGE plpgsql"""
68
66
  )
69
67
 
70
68
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2015-2019, Camptocamp SA
1
+ # Copyright (c) 2015-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Add description column in the tree.
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2015-2019, Camptocamp SA
1
+ # Copyright (c) 2015-2025, Camptocamp SA
4
2
  # All rights reserved.
5
3
 
6
4
  # Redistribution and use in source and binary forms, with or without
@@ -27,7 +25,7 @@
27
25
  # of the authors and should not be interpreted as representing official policies,
28
26
  # either expressed or implied, of the FreeBSD Project.
29
27
 
30
- # pylint: disable=no-member
28
+ # pylint: disable=invalid-name
31
29
 
32
30
  """
33
31
  Merge 1.6 and master branches.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2015-2019, Camptocamp SA
1
+ # Copyright (c) 2015-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Set layergroup_treeitem.id as a primary key.
@@ -0,0 +1,77 @@
1
+ # Copyright (c) 2024-2025, Camptocamp SA
2
+ # All rights reserved.
3
+
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+
7
+ # 1. Redistributions of source code must retain the above copyright notice, this
8
+ # list of conditions and the following disclaimer.
9
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ # this list of conditions and the following disclaimer in the documentation
11
+ # and/or other materials provided with the distribution.
12
+
13
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
17
+ # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20
+ # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
+
24
+ # The views and conclusions contained in the software and documentation are those
25
+ # of the authors and should not be interpreted as representing official policies,
26
+ # either expressed or implied, of the FreeBSD Project.
27
+
28
+ # pylint: disable=invalid-name
29
+
30
+ """
31
+ Update the OGC server for OGC API.
32
+
33
+ Revision ID: 2e57710fecfe
34
+ Revises: a4558f032d7d
35
+ Create Date: 2024-11-27 12:47:20.234376
36
+ """
37
+
38
+ from alembic import op
39
+ from c2c.template.config import config
40
+
41
+ # revision identifiers, used by Alembic.
42
+ revision = "2e57710fecfe"
43
+ down_revision = "a4558f032d7d"
44
+ branch_labels = None
45
+ depends_on = None
46
+
47
+
48
+ def upgrade() -> None:
49
+ """Upgrade."""
50
+ schema = config["schema"]
51
+
52
+ # Instructions
53
+
54
+ # default 'image/jpeg', 'image/png'
55
+ op.execute(f"UPDATE {schema}.ogc_server SET name = 'MapServer' WHERE name = 'source for image/png'")
56
+ op.execute(f"UPDATE {schema}.ogc_server SET name = 'MapServer_JPEG' WHERE name = 'source for image/jpeg'")
57
+ op.execute(
58
+ f"UPDATE {schema}.ogc_server SET url = 'config://mapserver/mapserv_proxy/MapServer?MAP=MapServer' WHERE url = 'config://mapserver'"
59
+ )
60
+ op.execute(
61
+ f"UPDATE {schema}.metadata SET value = 'MapServer' WHERE value = 'source for image/png' and name = 'ogcServer'"
62
+ )
63
+
64
+
65
+ def downgrade() -> None:
66
+ """Downgrade."""
67
+ schema = config["schema"]
68
+
69
+ # Instructions
70
+ op.execute(f"UPDATE {schema}.ogc_server SET name = 'source for image/png' WHERE name = 'MapServer'")
71
+ op.execute(f"UPDATE {schema}.ogc_server SET name = 'source for image/jpeg' WHERE name = 'MapServer_JPEG'")
72
+ op.execute(
73
+ f"UPDATE {schema}.ogc_server SET url = 'config://mapserver' WHERE url = 'config://mapserver/mapserv_proxy/MapServer?MAP=MapServer'"
74
+ )
75
+ op.execute(
76
+ f"UPDATE {schema}.metadata SET value = 'source for image/png' WHERE value = 'MapServer' and name = 'ogcServer'"
77
+ )
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2015-2019, Camptocamp SA
1
+ # Copyright (c) 2015-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
25
25
  # of the authors and should not be interpreted as representing official policies,
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
- # pylint: disable=no-member
28
+ # pylint: disable=no-member,invalid-name
29
29
 
30
30
  """
31
31
  Move exclude_properties from LayerV1 to Layer.
@@ -51,9 +51,9 @@ def upgrade() -> None:
51
51
 
52
52
  op.add_column("layer", Column("exclude_properties", Unicode), schema=schema)
53
53
  op.execute(
54
- "UPDATE %(schema)s.layer as l1 SET exclude_properties = l2.exclude_properties "
55
- "FROM %(schema)s.layerv1 as l2 "
56
- "WHERE l1.id = l2.id" % {"schema": schema}
54
+ f"UPDATE {schema}.layer as l1 SET exclude_properties = l2.exclude_properties "
55
+ f"FROM {schema}.layerv1 as l2 "
56
+ "WHERE l1.id = l2.id"
57
57
  )
58
58
  op.drop_column("layerv1", "exclude_properties", schema=schema)
59
59
 
@@ -64,8 +64,8 @@ def downgrade() -> None:
64
64
 
65
65
  op.add_column("layerv1", Column("exclude_properties", Unicode), schema=schema)
66
66
  op.execute(
67
- "UPDATE %(schema)s.layerv1 as l1 SET exclude_properties = l2.exclude_properties "
68
- "FROM %(schema)s.layer as l2 "
69
- "WHERE l1.id = l2.id" % {"schema": schema}
67
+ f"UPDATE {schema}.layerv1 as l1 SET exclude_properties = l2.exclude_properties "
68
+ f"FROM {schema}.layer as l2 "
69
+ "WHERE l1.id = l2.id"
70
70
  )
71
71
  op.drop_column("layer", "exclude_properties", schema=schema)
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2016-2019, Camptocamp SA
1
+ # Copyright (c) 2016-2025, Camptocamp SA
4
2
  # All rights reserved.
5
3
 
6
4
  # Redistribution and use in source and binary forms, with or without
@@ -27,7 +25,7 @@
27
25
  # of the authors and should not be interpreted as representing official policies,
28
26
  # either expressed or implied, of the FreeBSD Project.
29
27
 
30
- # pylint: disable=no-member
28
+ # pylint: disable=invalid-name
31
29
 
32
30
  """
33
31
  Merge e004f76e951a and e004f76e951a heads.