c2cgeoportal-commons 2.6.0__py3-none-any.whl → 2.9rc45__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.
Potentially problematic release.
This version of c2cgeoportal-commons might be problematic. Click here for more details.
- c2cgeoportal_commons/__init__.py +2 -5
- c2cgeoportal_commons/alembic/env.py +49 -33
- c2cgeoportal_commons/alembic/main/028477929d13_add_technical_roles.py +10 -7
- c2cgeoportal_commons/alembic/main/04f05bfbb05e_remove_the_old_is_expanded_column.py +62 -0
- c2cgeoportal_commons/alembic/main/116b9b79fc4d_internal_and_external_layer_tables_.py +42 -43
- c2cgeoportal_commons/alembic/main/1418cb05921b_merge_1_6_and_master_branches.py +9 -8
- c2cgeoportal_commons/alembic/main/164ac0819a61_add_image_format_to_wmts_layer.py +9 -6
- c2cgeoportal_commons/alembic/main/166ff2dcc48d_create_database.py +21 -24
- c2cgeoportal_commons/alembic/main/16e43f8c0330_remove_old_metadata_column.py +9 -6
- c2cgeoportal_commons/alembic/main/1d5d4abfebd1_add_restricted_theme.py +14 -8
- c2cgeoportal_commons/alembic/main/1de20166b274_remove_v1_artifacts.py +9 -6
- c2cgeoportal_commons/alembic/main/20137477bd02_update_icons_url.py +9 -6
- c2cgeoportal_commons/alembic/main/21f11066f8ec_trigger_on_role_updates_user_in_static.py +21 -20
- c2cgeoportal_commons/alembic/main/22e6dfb556de_add_description_tree_.py +9 -6
- c2cgeoportal_commons/alembic/main/29f2a32859ec_merge_1_6_and_master_branches.py +9 -8
- c2cgeoportal_commons/alembic/main/2b8ed8c1df94_set_layergroup_treeitem_is_as_a_primary_.py +9 -6
- c2cgeoportal_commons/alembic/main/2e57710fecfe_update_the_ogc_server_for_ogc_api.py +71 -0
- c2cgeoportal_commons/alembic/main/32527659d57b_move_exclude_properties_from_layerv1_to_.py +15 -12
- c2cgeoportal_commons/alembic/main/32b21aa1d0ed_merge_e004f76e951a_and_e004f76e951a_.py +9 -8
- c2cgeoportal_commons/alembic/main/338b57593823_remove_trigger_on_role_name_change.py +25 -24
- c2cgeoportal_commons/alembic/main/415746eb9f6_changes_for_v2.py +45 -43
- c2cgeoportal_commons/alembic/main/44c91d82d419_add_table_log.py +72 -0
- c2cgeoportal_commons/alembic/main/5109242131ce_add_column_time_widget.py +11 -9
- c2cgeoportal_commons/alembic/main/52916d8fde8b_add_sql_fields_to_vector_tiles.py +60 -0
- c2cgeoportal_commons/alembic/main/53ba1a68d5fe_add_theme_to_fulltextsearch.py +9 -6
- c2cgeoportal_commons/alembic/main/54645a535ad6_add_ordering_in_relation.py +17 -14
- c2cgeoportal_commons/alembic/main/56dc90838d90_fix_removing_layerv1.py +10 -8
- c2cgeoportal_commons/alembic/main/596ba21e3833_separate_local_internal.py +13 -14
- c2cgeoportal_commons/alembic/main/678f88c7ad5e_add_vector_tiles_layers_table.py +9 -6
- c2cgeoportal_commons/alembic/main/6a412d9437b1_rename_serverogc_to_ogcserver.py +9 -6
- c2cgeoportal_commons/alembic/main/6d87fdad275a_convert_metadata_to_the_right_case.py +13 -20
- c2cgeoportal_commons/alembic/main/7530011a66a7_trigger_on_role_updates_user_in_static.py +21 -20
- c2cgeoportal_commons/alembic/main/78fd093c8393_add_api_s_intrfaces.py +36 -52
- c2cgeoportal_commons/alembic/main/7d271f4527cd_add_layer_column_in_layerv1_table.py +9 -6
- c2cgeoportal_commons/alembic/main/809650bd04c3_add_dimension_field.py +9 -6
- c2cgeoportal_commons/alembic/main/8117bb9bba16_use_dimension_on_all_the_layers.py +9 -6
- c2cgeoportal_commons/alembic/main/87f8330ed64e_add_missing_delete_cascades.py +9 -6
- c2cgeoportal_commons/alembic/main/9268a1dffac0_add_trigger_to_be_able_to_correctly_.py +11 -8
- c2cgeoportal_commons/alembic/main/94db7e7e5b21_merge_2_2_and_master_branches.py +9 -8
- c2cgeoportal_commons/alembic/main/951ff84bd8ec_be_able_to_delete_a_wms_layer_in_sql.py +9 -6
- c2cgeoportal_commons/alembic/main/a00109812f89_add_field_layer_wms_valid.py +11 -8
- 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 +9 -8
- c2cgeoportal_commons/alembic/main/b60f2a505f42_remame_uimetadata_to_metadata.py +9 -6
- c2cgeoportal_commons/alembic/main/b6b09f414fe8_sync_model_database.py +165 -0
- c2cgeoportal_commons/alembic/main/c75124553bf3_remove_deprecated_columns.py +9 -6
- c2cgeoportal_commons/alembic/main/d48a63b348f1_change_mapserver_url_for_docker.py +13 -14
- c2cgeoportal_commons/alembic/main/d8ef99bc227e_be_able_to_delete_a_linked_functionality.py +15 -12
- c2cgeoportal_commons/alembic/main/daf738d5bae4_merge_2_0_and_master_branches.py +9 -8
- c2cgeoportal_commons/alembic/main/dba87f2647f9_merge_2_2_on_2_3.py +9 -8
- c2cgeoportal_commons/alembic/main/e004f76e951a_add_missing_not_null.py +15 -32
- c2cgeoportal_commons/alembic/main/e7e03dedade3_put_the_default_wms_server_in_the_.py +13 -14
- c2cgeoportal_commons/alembic/main/e85afd327ab3_cascade_deletes_to_tsearch.py +9 -6
- c2cgeoportal_commons/alembic/main/ec82a8906649_add_missing_on_delete_cascade_on_layer_.py +13 -10
- c2cgeoportal_commons/alembic/main/ee25d267bf46_main_interface_desktop.py +11 -14
- c2cgeoportal_commons/alembic/main/eeb345672454_merge_2_4_and_master_branches.py +9 -8
- c2cgeoportal_commons/alembic/static/0c640a58a09a_add_opt_key_column.py +9 -6
- c2cgeoportal_commons/alembic/static/107b81f5b9fe_add_missing_delete_cascades.py +9 -6
- c2cgeoportal_commons/alembic/static/1857owc78a07_add_last_login_and_expiration_date.py +7 -6
- c2cgeoportal_commons/alembic/static/1da396a88908_move_user_table_to_static_schema.py +19 -20
- 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 +8 -7
- c2cgeoportal_commons/alembic/static/44c91d82d419_add_table_log.py +72 -0
- c2cgeoportal_commons/alembic/static/53d671b17b20_add_timezone_on_datetime_fields.py +9 -6
- c2cgeoportal_commons/alembic/static/5472fbc19f39_add_temp_password_column.py +9 -6
- c2cgeoportal_commons/alembic/static/76d72fb3fcb9_add_oauth2_pkce.py +70 -0
- c2cgeoportal_commons/alembic/static/7ef947f30f20_add_oauth2_tables.py +9 -6
- 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 +15 -18
- c2cgeoportal_commons/alembic/static/bd029dbfc11a_fill_tech_data_column.py +10 -8
- c2cgeoportal_commons/lib/email_.py +14 -16
- c2cgeoportal_commons/lib/literal.py +44 -0
- c2cgeoportal_commons/lib/url.py +164 -58
- c2cgeoportal_commons/lib/validators.py +2 -4
- c2cgeoportal_commons/models/__init__.py +19 -15
- c2cgeoportal_commons/models/main.py +1191 -263
- c2cgeoportal_commons/models/sqlalchemy.py +14 -18
- c2cgeoportal_commons/models/static.py +305 -78
- c2cgeoportal_commons/py.typed +0 -0
- c2cgeoportal_commons/testing/__init__.py +17 -12
- c2cgeoportal_commons/testing/initializedb.py +15 -14
- {c2cgeoportal_commons-2.6.0.dist-info → c2cgeoportal_commons-2.9rc45.dist-info}/METADATA +15 -16
- c2cgeoportal_commons-2.9rc45.dist-info/RECORD +89 -0
- {c2cgeoportal_commons-2.6.0.dist-info → c2cgeoportal_commons-2.9rc45.dist-info}/WHEEL +1 -1
- tests/conftest.py +1 -3
- c2cgeoportal_commons-2.6.0.dist-info/RECORD +0 -76
- {c2cgeoportal_commons-2.6.0.dist-info → c2cgeoportal_commons-2.9rc45.dist-info}/top_level.txt +0 -0
c2cgeoportal_commons/__init__.py
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2011-2020, Camptocamp SA
|
|
1
|
+
# Copyright (c) 2011-2021, Camptocamp SA
|
|
4
2
|
# All rights reserved.
|
|
5
3
|
|
|
6
4
|
# Redistribution and use in source and binary forms, with or without
|
|
@@ -28,8 +26,6 @@
|
|
|
28
26
|
# either expressed or implied, of the FreeBSD Project.
|
|
29
27
|
|
|
30
28
|
|
|
31
|
-
from typing import Optional # noqa, pylint: disable=unused-import
|
|
32
|
-
|
|
33
29
|
from c2c.template.config import config as configuration
|
|
34
30
|
from pyramid.config import Configurator
|
|
35
31
|
|
|
@@ -37,6 +33,7 @@ from pyramid.config import Configurator
|
|
|
37
33
|
def includeme(config: Configurator) -> None:
|
|
38
34
|
"""
|
|
39
35
|
Initialize the model for a Pyramid app.
|
|
36
|
+
|
|
40
37
|
Activate this setup using ``config.include('c2cgeoportal_admin.commons')``.
|
|
41
38
|
"""
|
|
42
39
|
settings = config.get_settings()
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2014-2019, Camptocamp SA
|
|
1
|
+
# Copyright (c) 2014-2024, Camptocamp SA
|
|
4
2
|
# All rights reserved.
|
|
5
3
|
|
|
6
4
|
# Redistribution and use in source and binary forms, with or without
|
|
@@ -28,40 +26,55 @@
|
|
|
28
26
|
# either expressed or implied, of the FreeBSD Project.
|
|
29
27
|
|
|
30
28
|
|
|
29
|
+
# pylint: disable=no-member
|
|
30
|
+
|
|
31
31
|
import logging.config
|
|
32
|
-
from typing import
|
|
32
|
+
from typing import Any, cast
|
|
33
33
|
|
|
34
|
-
import
|
|
34
|
+
import sqlalchemy
|
|
35
35
|
from alembic import context
|
|
36
36
|
from c2c.template.config import config
|
|
37
|
+
from plaster.loaders import setup_logging
|
|
37
38
|
from sqlalchemy import engine_from_config, pool
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
_LOG = logging.getLogger(__name__)
|
|
40
41
|
|
|
41
42
|
|
|
42
43
|
# Interpret the config file for Python logging.
|
|
43
44
|
# This line sets up loggers basically.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
def get_config():
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
setup_logging(context.config.config_file_name)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def get_config() -> dict[str, str | bool]:
|
|
49
|
+
"""Get the application configuration."""
|
|
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)
|
|
51
57
|
alembic_name = context.config.get_main_option("type")
|
|
52
|
-
|
|
58
|
+
schema_postfix = f"_{alembic_name}" if alembic_name != "main" else ""
|
|
59
|
+
schema_config_name = f"schema{schema_postfix}"
|
|
60
|
+
script_location = context.config.get_main_option("script_location")
|
|
61
|
+
version_table = context.config.get_main_option("version_table")
|
|
62
|
+
version_locations = context.config.get_main_option("version_locations")
|
|
63
|
+
assert script_location
|
|
64
|
+
assert version_table
|
|
65
|
+
assert version_locations
|
|
53
66
|
settings.update(
|
|
54
67
|
{
|
|
55
|
-
"script_location":
|
|
56
|
-
"version_table":
|
|
57
|
-
"version_locations":
|
|
68
|
+
"script_location": script_location,
|
|
69
|
+
"version_table": version_table,
|
|
70
|
+
"version_locations": version_locations,
|
|
58
71
|
"version_table_schema": config[schema_config_name],
|
|
59
72
|
}
|
|
60
73
|
)
|
|
61
74
|
return settings
|
|
62
75
|
|
|
63
76
|
|
|
64
|
-
def run_migrations_offline()
|
|
77
|
+
def run_migrations_offline() -> None:
|
|
65
78
|
"""
|
|
66
79
|
Run migrations in 'offline' mode.
|
|
67
80
|
|
|
@@ -72,37 +85,40 @@ def run_migrations_offline(): # pragma: no cover
|
|
|
72
85
|
|
|
73
86
|
Calls to context.execute() here emit the given string to the
|
|
74
87
|
script output.
|
|
75
|
-
|
|
76
88
|
"""
|
|
77
89
|
conf = get_config()
|
|
78
|
-
context.configure(url=conf["sqlalchemy.url"], **conf)
|
|
90
|
+
context.configure(url=conf["sqlalchemy.url"], **conf) # type: ignore
|
|
79
91
|
|
|
80
92
|
with context.begin_transaction():
|
|
81
93
|
context.run_migrations()
|
|
82
94
|
|
|
83
95
|
|
|
84
|
-
def run_migrations_online():
|
|
96
|
+
def run_migrations_online() -> None:
|
|
85
97
|
"""
|
|
86
98
|
Run migrations in 'online' mode.
|
|
87
99
|
|
|
88
|
-
In this scenario we need to create an Engine
|
|
89
|
-
and associate a connection with the context.
|
|
90
|
-
|
|
100
|
+
In this scenario we need to create an Engine and associate a connection with the context.
|
|
91
101
|
"""
|
|
92
|
-
conf = get_config()
|
|
102
|
+
conf: dict[str, Any] = get_config()
|
|
93
103
|
|
|
94
104
|
# Autogenerate config
|
|
95
105
|
alembic_name = context.config.get_main_option("type")
|
|
96
|
-
from c2cgeoportal_commons.models import main, static
|
|
106
|
+
from c2cgeoportal_commons.models import Base, main, static # pylint: disable=import-outside-toplevel
|
|
107
|
+
|
|
108
|
+
_schema = main._schema if alembic_name == "main" else static._schema # pylint: disable=protected-access
|
|
97
109
|
|
|
98
|
-
|
|
99
|
-
|
|
110
|
+
def include_object(
|
|
111
|
+
obj: sqlalchemy.ext.declarative.ConcreteBase,
|
|
112
|
+
name: str,
|
|
113
|
+
type_: str,
|
|
114
|
+
reflected: str,
|
|
115
|
+
compare_to: str,
|
|
116
|
+
) -> bool:
|
|
117
|
+
del name, reflected, compare_to
|
|
100
118
|
|
|
101
|
-
def include_object(obj, name, type_, reflected, compare_to): # pylint: disable=unused-argument
|
|
102
119
|
if type_ == "table":
|
|
103
|
-
return obj.schema == _schema
|
|
104
|
-
|
|
105
|
-
return 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]
|
|
106
122
|
|
|
107
123
|
if _schema:
|
|
108
124
|
conf.update(
|
|
@@ -120,7 +136,7 @@ def run_migrations_online():
|
|
|
120
136
|
connection.close()
|
|
121
137
|
|
|
122
138
|
|
|
123
|
-
if context.is_offline_mode():
|
|
139
|
+
if context.is_offline_mode():
|
|
124
140
|
run_migrations_offline()
|
|
125
141
|
else:
|
|
126
142
|
run_migrations_online()
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2019, Camptocamp SA
|
|
1
|
+
# Copyright (c) 2019-2024, 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,10 @@
|
|
|
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
|
-
|
|
28
|
+
# pylint: disable=no-member,invalid-name
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
Add technical roles.
|
|
31
32
|
|
|
32
33
|
Revision ID: 028477929d13
|
|
33
34
|
Revises: eeb345672454
|
|
@@ -46,7 +47,8 @@ branch_labels = None
|
|
|
46
47
|
depends_on = None
|
|
47
48
|
|
|
48
49
|
|
|
49
|
-
def upgrade():
|
|
50
|
+
def upgrade() -> None:
|
|
51
|
+
"""Upgrade."""
|
|
50
52
|
schema = config["schema"]
|
|
51
53
|
|
|
52
54
|
role = Table("role", MetaData(), Column("name", Unicode), Column("description", Unicode), schema=schema)
|
|
@@ -63,8 +65,9 @@ def upgrade():
|
|
|
63
65
|
)
|
|
64
66
|
|
|
65
67
|
|
|
66
|
-
def downgrade():
|
|
68
|
+
def downgrade() -> None:
|
|
69
|
+
"""Downgrade."""
|
|
67
70
|
schema = config["schema"]
|
|
68
71
|
|
|
69
72
|
for name in ("anonymous", "registered", "intranet"):
|
|
70
|
-
op.execute(
|
|
73
|
+
op.execute(f"DELETE FROM {schema}.\"role\" WHERE name = '{name}'")
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Copyright (c) 2020-2024, 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
|
+
Remove the old is_expanded column.
|
|
32
|
+
|
|
33
|
+
Revision ID: 04f05bfbb05e
|
|
34
|
+
Revises: 52916d8fde8b
|
|
35
|
+
Create Date: 2022-01-26 14:48:26.003526
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
from alembic import op
|
|
39
|
+
from c2c.template.config import config
|
|
40
|
+
from sqlalchemy import Boolean, Column
|
|
41
|
+
|
|
42
|
+
# revision identifiers, used by Alembic.
|
|
43
|
+
revision = "04f05bfbb05e"
|
|
44
|
+
down_revision = "52916d8fde8b"
|
|
45
|
+
branch_labels = None
|
|
46
|
+
depends_on = None
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def upgrade() -> None:
|
|
50
|
+
"""Upgrade."""
|
|
51
|
+
schema = config["schema"]
|
|
52
|
+
|
|
53
|
+
# Instructions
|
|
54
|
+
op.drop_column("layergroup", "is_expanded", schema=schema)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def downgrade() -> None:
|
|
58
|
+
"""Downgrade."""
|
|
59
|
+
schema = config["schema"]
|
|
60
|
+
|
|
61
|
+
# Instructions
|
|
62
|
+
op.add_column("layergroup", Column("is_expanded", Boolean), schema=schema)
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2015-2019, Camptocamp SA
|
|
1
|
+
# Copyright (c) 2015-2024, 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,10 @@
|
|
|
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
|
-
|
|
28
|
+
# pylint: disable=no-member,invalid-name
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
internal and external layer tables refactoring, new ogc table.
|
|
31
32
|
|
|
32
33
|
Revision ID: 116b9b79fc4d
|
|
33
34
|
Revises: 1418cb05921b
|
|
@@ -46,7 +47,8 @@ branch_labels = None
|
|
|
46
47
|
depends_on = None
|
|
47
48
|
|
|
48
49
|
|
|
49
|
-
def upgrade():
|
|
50
|
+
def upgrade() -> None:
|
|
51
|
+
"""Upgrade."""
|
|
50
52
|
schema = config["schema"]
|
|
51
53
|
|
|
52
54
|
# Instructions
|
|
@@ -84,7 +86,7 @@ def upgrade():
|
|
|
84
86
|
|
|
85
87
|
# default 'image/jpeg', 'image/png'
|
|
86
88
|
op.execute(
|
|
87
|
-
"INSERT INTO
|
|
89
|
+
f"INSERT INTO {schema}.server_ogc (name, description, type, image_type, "
|
|
88
90
|
" auth, wfs_support) "
|
|
89
91
|
"SELECT 'source for ' || image_type AS name, "
|
|
90
92
|
" 'default source for internal ' || image_type AS description, "
|
|
@@ -94,11 +96,11 @@ def upgrade():
|
|
|
94
96
|
" 'true' AS wfs_support "
|
|
95
97
|
"FROM ("
|
|
96
98
|
" SELECT UNNEST(ARRAY['image/jpeg', 'image/png']) AS image_type"
|
|
97
|
-
") AS foo"
|
|
99
|
+
") AS foo"
|
|
98
100
|
)
|
|
99
101
|
# other custom image types
|
|
100
102
|
op.execute(
|
|
101
|
-
"INSERT INTO
|
|
103
|
+
f"INSERT INTO {schema}.server_ogc (name, description, type, image_type, "
|
|
102
104
|
" auth, wfs_support) "
|
|
103
105
|
"SELECT 'source for ' || image_type AS name, "
|
|
104
106
|
" 'default source for internal ' || image_type AS description, "
|
|
@@ -107,60 +109,57 @@ def upgrade():
|
|
|
107
109
|
" 'Standard auth' AS auth, "
|
|
108
110
|
" 'true' AS wfs_support "
|
|
109
111
|
"FROM ("
|
|
110
|
-
" SELECT DISTINCT(image_type) FROM
|
|
112
|
+
f" SELECT DISTINCT(image_type) FROM {schema}.layer_internal_wms "
|
|
111
113
|
" WHERE image_type NOT IN ('image/jpeg', 'image/png')"
|
|
112
|
-
") as foo"
|
|
114
|
+
") as foo"
|
|
113
115
|
)
|
|
114
116
|
|
|
115
117
|
# layers for internal
|
|
116
118
|
|
|
117
119
|
# internal with not null image_type
|
|
118
120
|
op.execute(
|
|
119
|
-
"INSERT INTO
|
|
121
|
+
f"INSERT INTO {schema}.layer_wms (id, server_ogc_id, layer, style, "
|
|
120
122
|
" time_mode, time_widget) "
|
|
121
|
-
"SELECT
|
|
122
|
-
"FROM
|
|
123
|
-
"WHERE
|
|
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"
|
|
124
126
|
)
|
|
125
127
|
# internal with null image_type
|
|
126
128
|
op.execute(
|
|
127
|
-
"INSERT INTO
|
|
129
|
+
f"INSERT INTO {schema}.layer_wms (id, server_ogc_id, layer, style, "
|
|
128
130
|
" time_mode, time_widget) "
|
|
129
|
-
"SELECT
|
|
130
|
-
"FROM
|
|
131
|
-
"WHERE
|
|
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'"
|
|
132
134
|
)
|
|
133
135
|
|
|
134
136
|
# ocg for externals
|
|
135
137
|
op.execute(
|
|
136
|
-
"INSERT INTO
|
|
138
|
+
f"INSERT INTO {schema}.server_ogc (name, url, type, image_type, auth, is_single_tile) "
|
|
137
139
|
"SELECT 'source for ' || url, url, 'mapserver' AS type, image_type, 'none', CASE "
|
|
138
140
|
"WHEN is_single_tile IS TRUE THEN TRUE ELSE FALSE END as is_single_tile "
|
|
139
|
-
"FROM
|
|
141
|
+
f"FROM {schema}.layer_external_wms GROUP BY url, image_type, is_single_tile"
|
|
140
142
|
)
|
|
141
143
|
|
|
142
144
|
# layers for external
|
|
143
145
|
op.execute(
|
|
144
|
-
"INSERT INTO
|
|
146
|
+
f"INSERT INTO {schema}.layer_wms (id, server_ogc_id, layer, style, "
|
|
145
147
|
" time_mode, time_widget) "
|
|
146
|
-
"SELECT
|
|
147
|
-
"FROM
|
|
148
|
-
"WHERE
|
|
149
|
-
"AND
|
|
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"
|
|
150
152
|
)
|
|
151
153
|
|
|
152
154
|
op.drop_table("layer_external_wms", schema=schema)
|
|
153
155
|
op.drop_table("layer_internal_wms", schema=schema)
|
|
154
156
|
|
|
155
157
|
# update layer type in treeitems
|
|
156
|
-
op.execute(
|
|
157
|
-
"UPDATE %(schema)s.treeitem "
|
|
158
|
-
"SET type='l_wms' "
|
|
159
|
-
"WHERE type='l_int_wms' OR type='l_ext_wms'" % {"schema": schema}
|
|
160
|
-
)
|
|
158
|
+
op.execute(f"UPDATE {schema}.treeitem " "SET type='l_wms' " "WHERE type='l_int_wms' OR type='l_ext_wms'")
|
|
161
159
|
|
|
162
160
|
|
|
163
|
-
def downgrade():
|
|
161
|
+
def downgrade() -> None:
|
|
162
|
+
"""Downgrade."""
|
|
164
163
|
schema = config["schema"]
|
|
165
164
|
|
|
166
165
|
# Instructions
|
|
@@ -193,20 +192,20 @@ def downgrade():
|
|
|
193
192
|
|
|
194
193
|
# internal (type is not null)
|
|
195
194
|
op.execute(
|
|
196
|
-
"INSERT INTO
|
|
195
|
+
f"INSERT INTO {schema}.layer_internal_wms (id, layer, image_type, style, "
|
|
197
196
|
" time_mode, time_widget) "
|
|
198
197
|
"SELECT w.id, layer, image_type, style, time_mode, time_widget "
|
|
199
|
-
"FROM
|
|
200
|
-
"WHERE w.server_ogc_id=o.id AND o.type IS NOT NULL"
|
|
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"
|
|
201
200
|
)
|
|
202
201
|
|
|
203
202
|
# external (type is null)
|
|
204
203
|
op.execute(
|
|
205
|
-
"INSERT INTO
|
|
204
|
+
f"INSERT INTO {schema}.layer_external_wms (id, url, layer, image_type, style, "
|
|
206
205
|
" is_single_tile, time_mode, time_widget) "
|
|
207
206
|
"SELECT w.id, url, layer, image_type, style, is_single_tile, time_mode, time_widget "
|
|
208
|
-
"FROM
|
|
209
|
-
"WHERE w.server_ogc_id=o.id AND o.type IS NULL"
|
|
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"
|
|
210
209
|
)
|
|
211
210
|
|
|
212
211
|
# drop table AFTER moving data back
|
|
@@ -216,15 +215,15 @@ def downgrade():
|
|
|
216
215
|
# update layer type in treeitems
|
|
217
216
|
# internal
|
|
218
217
|
op.execute(
|
|
219
|
-
"UPDATE
|
|
218
|
+
f"UPDATE {schema}.treeitem "
|
|
220
219
|
"SET type='l_int_wms' "
|
|
221
|
-
"FROM
|
|
222
|
-
"WHERE
|
|
220
|
+
f"FROM {schema}.layer_internal_wms as w "
|
|
221
|
+
f"WHERE {schema}.treeitem.id=w.id"
|
|
223
222
|
)
|
|
224
223
|
# external
|
|
225
224
|
op.execute(
|
|
226
|
-
"UPDATE
|
|
225
|
+
f"UPDATE {schema}.treeitem "
|
|
227
226
|
"SET type='l_ext_wms' "
|
|
228
|
-
"FROM
|
|
229
|
-
"WHERE
|
|
227
|
+
f"FROM {schema}.layer_external_wms as w "
|
|
228
|
+
f"WHERE {schema}.treeitem.id=w.id"
|
|
230
229
|
)
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2015-2019, Camptocamp SA
|
|
1
|
+
# Copyright (c) 2015-2024, 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,10 @@
|
|
|
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
|
-
|
|
28
|
+
# pylint: disable=invalid-name
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
Merge 1.6 and master branches.
|
|
31
32
|
|
|
32
33
|
Revision ID: 1418cb05921b
|
|
33
34
|
Revises: ('32527659d57b', '53ba1a68d5fe')
|
|
@@ -41,9 +42,9 @@ branch_labels = None
|
|
|
41
42
|
depends_on = None
|
|
42
43
|
|
|
43
44
|
|
|
44
|
-
def upgrade():
|
|
45
|
-
|
|
45
|
+
def upgrade() -> None:
|
|
46
|
+
"""Upgrade."""
|
|
46
47
|
|
|
47
48
|
|
|
48
|
-
def downgrade():
|
|
49
|
-
|
|
49
|
+
def downgrade() -> None:
|
|
50
|
+
"""Downgrade."""
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2015-2019, Camptocamp SA
|
|
1
|
+
# Copyright (c) 2015-2024, 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,10 @@
|
|
|
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
|
-
|
|
28
|
+
# pylint: disable=no-member,invalid-name
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
Add image format to WMTS layer.
|
|
31
32
|
|
|
32
33
|
Revision ID: 164ac0819a61
|
|
33
34
|
Revises: 20137477bd02
|
|
@@ -43,13 +44,15 @@ revision = "164ac0819a61"
|
|
|
43
44
|
down_revision = "20137477bd02"
|
|
44
45
|
|
|
45
46
|
|
|
46
|
-
def upgrade():
|
|
47
|
+
def upgrade() -> None:
|
|
48
|
+
"""Upgrade."""
|
|
47
49
|
schema = config["schema"]
|
|
48
50
|
|
|
49
51
|
op.add_column("layer_wmts", Column("image_type", Unicode(10)), schema=schema)
|
|
50
52
|
|
|
51
53
|
|
|
52
|
-
def downgrade():
|
|
54
|
+
def downgrade() -> None:
|
|
55
|
+
"""Downgrade."""
|
|
53
56
|
schema = config["schema"]
|
|
54
57
|
|
|
55
58
|
op.drop_column("layer_wmts", "image_type", schema=schema)
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2014-2019, Camptocamp SA
|
|
1
|
+
# Copyright (c) 2014-2024, 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,10 @@
|
|
|
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
|
-
|
|
28
|
+
# pylint: disable=no-member,invalid-name
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
create database.
|
|
31
32
|
|
|
32
33
|
Revision ID: 166ff2dcc48d
|
|
33
34
|
Revises:
|
|
@@ -46,24 +47,26 @@ revision = "166ff2dcc48d"
|
|
|
46
47
|
down_revision = None
|
|
47
48
|
|
|
48
49
|
|
|
49
|
-
class TsVector(UserDefinedType):
|
|
50
|
+
class TsVector(UserDefinedType): # type: ignore # pylint: disable=abstract-method
|
|
50
51
|
"""A custom type for PostgreSQL's tsvector type."""
|
|
51
52
|
|
|
52
|
-
def get_col_spec(self):
|
|
53
|
+
def get_col_spec(self) -> str:
|
|
53
54
|
return "TSVECTOR"
|
|
54
55
|
|
|
55
56
|
|
|
56
|
-
def upgrade():
|
|
57
|
+
def upgrade() -> None:
|
|
58
|
+
"""Upgrade."""
|
|
57
59
|
schema = config["schema"]
|
|
58
60
|
schema_static = config["schema_static"]
|
|
59
61
|
parentschema = config.get("parentschema")
|
|
60
62
|
srid = config.get("srid")
|
|
61
63
|
|
|
62
64
|
engine = op.get_bind().engine
|
|
63
|
-
|
|
64
|
-
engine
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
with engine.connect() as connection:
|
|
66
|
+
if type(engine).__name__ != "MockConnection" and op.get_context().dialect.has_table(
|
|
67
|
+
connection, "functionality", schema=schema
|
|
68
|
+
):
|
|
69
|
+
return
|
|
67
70
|
|
|
68
71
|
op.create_table(
|
|
69
72
|
"functionality",
|
|
@@ -191,7 +194,7 @@ def upgrade():
|
|
|
191
194
|
Column("role_id", Integer, ForeignKey(schema + ".role.id"), nullable=False),
|
|
192
195
|
schema=schema,
|
|
193
196
|
)
|
|
194
|
-
if parentschema is not None and parentschema != "":
|
|
197
|
+
if parentschema is not None and parentschema != "":
|
|
195
198
|
op.add_column(
|
|
196
199
|
"user", Column("parent_role_id", Integer, ForeignKey(parentschema + ".role.id")), schema=schema
|
|
197
200
|
)
|
|
@@ -199,7 +202,7 @@ def upgrade():
|
|
|
199
202
|
"INSERT INTO %(schema)s.user (type, username, email, password, role_id) "
|
|
200
203
|
"(SELECT 'user', 'admin', 'info@example.com', '%(pass)s', r.id "
|
|
201
204
|
"FROM %(schema)s.role AS r "
|
|
202
|
-
"WHERE r.name = 'role_admin')" % {"schema": schema, "pass": sha1("admin"
|
|
205
|
+
"WHERE r.name = 'role_admin')" % {"schema": schema, "pass": sha1(b"admin").hexdigest()} # nosec
|
|
203
206
|
)
|
|
204
207
|
|
|
205
208
|
op.create_table(
|
|
@@ -250,19 +253,13 @@ def upgrade():
|
|
|
250
253
|
schema=schema,
|
|
251
254
|
)
|
|
252
255
|
|
|
253
|
-
op.execute(
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
)
|
|
257
|
-
op.execute(
|
|
258
|
-
"INSERT INTO {schema}.treegroup (id) SELECT id " "FROM {schema}.treeitem".format(schema=schema)
|
|
259
|
-
)
|
|
260
|
-
op.execute(
|
|
261
|
-
"INSERT INTO {schema}.layergroup (id) SELECT id " "FROM {schema}.treeitem".format(schema=schema)
|
|
262
|
-
)
|
|
256
|
+
op.execute(f'INSERT INTO {schema}.treeitem (type, name, "order") ' "VALUES ('group', 'background', 0)")
|
|
257
|
+
op.execute(f"INSERT INTO {schema}.treegroup (id) SELECT id FROM {schema}.treeitem")
|
|
258
|
+
op.execute(f"INSERT INTO {schema}.layergroup (id) SELECT id FROM {schema}.treeitem")
|
|
263
259
|
|
|
264
260
|
|
|
265
|
-
def downgrade():
|
|
261
|
+
def downgrade() -> None:
|
|
262
|
+
"""Downgrade."""
|
|
266
263
|
schema = config["schema"]
|
|
267
264
|
schema_static = config["schema_static"]
|
|
268
265
|
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2019, Camptocamp SA
|
|
1
|
+
# Copyright (c) 2019-2024, 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,10 @@
|
|
|
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
|
-
|
|
28
|
+
# pylint: disable=no-member,invalid-name
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
Remove old metadata column.
|
|
31
32
|
|
|
32
33
|
Revision ID: 16e43f8c0330
|
|
33
34
|
Revises: 678f88c7ad5e
|
|
@@ -45,13 +46,15 @@ branch_labels = None
|
|
|
45
46
|
depends_on = None
|
|
46
47
|
|
|
47
48
|
|
|
48
|
-
def upgrade():
|
|
49
|
+
def upgrade() -> None:
|
|
50
|
+
"""Upgrade."""
|
|
49
51
|
schema = config["schema"]
|
|
50
52
|
|
|
51
53
|
op.drop_column("treeitem", "metadata_url", schema=schema)
|
|
52
54
|
|
|
53
55
|
|
|
54
|
-
def downgrade():
|
|
56
|
+
def downgrade() -> None:
|
|
57
|
+
"""Downgrade."""
|
|
55
58
|
schema = config["schema"]
|
|
56
59
|
|
|
57
60
|
op.add_column("treeitem", Column("metadata_url", Unicode), schema=schema)
|