c2cgeoportal-commons 2.6.0__py3-none-any.whl → 2.8.1.180__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.

Files changed (82) hide show
  1. c2cgeoportal_commons/__init__.py +2 -5
  2. c2cgeoportal_commons/alembic/env.py +40 -28
  3. c2cgeoportal_commons/alembic/main/028477929d13_add_technical_roles.py +10 -7
  4. c2cgeoportal_commons/alembic/main/04f05bfbb05e_remove_the_old_is_expanded_column.py +60 -0
  5. c2cgeoportal_commons/alembic/main/116b9b79fc4d_internal_and_external_layer_tables_.py +42 -43
  6. c2cgeoportal_commons/alembic/main/1418cb05921b_merge_1_6_and_master_branches.py +7 -8
  7. c2cgeoportal_commons/alembic/main/164ac0819a61_add_image_format_to_wmts_layer.py +9 -6
  8. c2cgeoportal_commons/alembic/main/166ff2dcc48d_create_database.py +21 -24
  9. c2cgeoportal_commons/alembic/main/16e43f8c0330_remove_old_metadata_column.py +9 -6
  10. c2cgeoportal_commons/alembic/main/1d5d4abfebd1_add_restricted_theme.py +14 -8
  11. c2cgeoportal_commons/alembic/main/1de20166b274_remove_v1_artifacts.py +9 -6
  12. c2cgeoportal_commons/alembic/main/20137477bd02_update_icons_url.py +9 -6
  13. c2cgeoportal_commons/alembic/main/21f11066f8ec_trigger_on_role_updates_user_in_static.py +21 -20
  14. c2cgeoportal_commons/alembic/main/22e6dfb556de_add_description_tree_.py +9 -6
  15. c2cgeoportal_commons/alembic/main/29f2a32859ec_merge_1_6_and_master_branches.py +7 -8
  16. c2cgeoportal_commons/alembic/main/2b8ed8c1df94_set_layergroup_treeitem_is_as_a_primary_.py +9 -6
  17. c2cgeoportal_commons/alembic/main/32527659d57b_move_exclude_properties_from_layerv1_to_.py +15 -12
  18. c2cgeoportal_commons/alembic/main/32b21aa1d0ed_merge_e004f76e951a_and_e004f76e951a_.py +7 -8
  19. c2cgeoportal_commons/alembic/main/338b57593823_remove_trigger_on_role_name_change.py +25 -24
  20. c2cgeoportal_commons/alembic/main/415746eb9f6_changes_for_v2.py +45 -43
  21. c2cgeoportal_commons/alembic/main/44c91d82d419_add_table_log.py +70 -0
  22. c2cgeoportal_commons/alembic/main/5109242131ce_add_column_time_widget.py +10 -9
  23. c2cgeoportal_commons/alembic/main/52916d8fde8b_add_sql_fields_to_vector_tiles.py +58 -0
  24. c2cgeoportal_commons/alembic/main/53ba1a68d5fe_add_theme_to_fulltextsearch.py +9 -6
  25. c2cgeoportal_commons/alembic/main/54645a535ad6_add_ordering_in_relation.py +17 -14
  26. c2cgeoportal_commons/alembic/main/56dc90838d90_fix_removing_layerv1.py +10 -8
  27. c2cgeoportal_commons/alembic/main/596ba21e3833_separate_local_internal.py +13 -14
  28. c2cgeoportal_commons/alembic/main/678f88c7ad5e_add_vector_tiles_layers_table.py +9 -6
  29. c2cgeoportal_commons/alembic/main/6a412d9437b1_rename_serverogc_to_ogcserver.py +9 -6
  30. c2cgeoportal_commons/alembic/main/6d87fdad275a_convert_metadata_to_the_right_case.py +13 -20
  31. c2cgeoportal_commons/alembic/main/7530011a66a7_trigger_on_role_updates_user_in_static.py +21 -20
  32. c2cgeoportal_commons/alembic/main/78fd093c8393_add_api_s_intrfaces.py +27 -48
  33. c2cgeoportal_commons/alembic/main/7d271f4527cd_add_layer_column_in_layerv1_table.py +9 -6
  34. c2cgeoportal_commons/alembic/main/809650bd04c3_add_dimension_field.py +9 -6
  35. c2cgeoportal_commons/alembic/main/8117bb9bba16_use_dimension_on_all_the_layers.py +9 -6
  36. c2cgeoportal_commons/alembic/main/87f8330ed64e_add_missing_delete_cascades.py +9 -6
  37. c2cgeoportal_commons/alembic/main/9268a1dffac0_add_trigger_to_be_able_to_correctly_.py +11 -8
  38. c2cgeoportal_commons/alembic/main/94db7e7e5b21_merge_2_2_and_master_branches.py +7 -8
  39. c2cgeoportal_commons/alembic/main/951ff84bd8ec_be_able_to_delete_a_wms_layer_in_sql.py +9 -6
  40. c2cgeoportal_commons/alembic/main/a00109812f89_add_field_layer_wms_valid.py +9 -6
  41. c2cgeoportal_commons/alembic/main/a4f1aac9bda_merge_1_6_and_master_branches.py +7 -8
  42. c2cgeoportal_commons/alembic/main/b60f2a505f42_remame_uimetadata_to_metadata.py +9 -6
  43. c2cgeoportal_commons/alembic/main/c75124553bf3_remove_deprecated_columns.py +9 -6
  44. c2cgeoportal_commons/alembic/main/d48a63b348f1_change_mapserver_url_for_docker.py +13 -14
  45. c2cgeoportal_commons/alembic/main/d8ef99bc227e_be_able_to_delete_a_linked_functionality.py +15 -12
  46. c2cgeoportal_commons/alembic/main/daf738d5bae4_merge_2_0_and_master_branches.py +7 -8
  47. c2cgeoportal_commons/alembic/main/dba87f2647f9_merge_2_2_on_2_3.py +7 -8
  48. c2cgeoportal_commons/alembic/main/e004f76e951a_add_missing_not_null.py +15 -32
  49. c2cgeoportal_commons/alembic/main/e7e03dedade3_put_the_default_wms_server_in_the_.py +13 -14
  50. c2cgeoportal_commons/alembic/main/e85afd327ab3_cascade_deletes_to_tsearch.py +9 -6
  51. c2cgeoportal_commons/alembic/main/ec82a8906649_add_missing_on_delete_cascade_on_layer_.py +13 -10
  52. c2cgeoportal_commons/alembic/main/ee25d267bf46_main_interface_desktop.py +11 -14
  53. c2cgeoportal_commons/alembic/main/eeb345672454_merge_2_4_and_master_branches.py +7 -8
  54. c2cgeoportal_commons/alembic/static/0c640a58a09a_add_opt_key_column.py +9 -6
  55. c2cgeoportal_commons/alembic/static/107b81f5b9fe_add_missing_delete_cascades.py +9 -6
  56. c2cgeoportal_commons/alembic/static/1857owc78a07_add_last_login_and_expiration_date.py +7 -6
  57. c2cgeoportal_commons/alembic/static/1da396a88908_move_user_table_to_static_schema.py +18 -19
  58. c2cgeoportal_commons/alembic/static/3f89a7d71a5e_alter_column_url_to_remove_limitation.py +8 -7
  59. c2cgeoportal_commons/alembic/static/44c91d82d419_add_table_log.py +70 -0
  60. c2cgeoportal_commons/alembic/static/53d671b17b20_add_timezone_on_datetime_fields.py +9 -6
  61. c2cgeoportal_commons/alembic/static/5472fbc19f39_add_temp_password_column.py +9 -6
  62. c2cgeoportal_commons/alembic/static/76d72fb3fcb9_add_oauth2_pkce.py +68 -0
  63. c2cgeoportal_commons/alembic/static/7ef947f30f20_add_oauth2_tables.py +7 -6
  64. c2cgeoportal_commons/alembic/static/ae5e88f35669_add_table_user_role.py +15 -18
  65. c2cgeoportal_commons/alembic/static/bd029dbfc11a_fill_tech_data_column.py +10 -8
  66. c2cgeoportal_commons/lib/email_.py +11 -13
  67. c2cgeoportal_commons/lib/literal.py +44 -0
  68. c2cgeoportal_commons/lib/url.py +164 -57
  69. c2cgeoportal_commons/lib/validators.py +2 -4
  70. c2cgeoportal_commons/models/__init__.py +7 -10
  71. c2cgeoportal_commons/models/main.py +968 -127
  72. c2cgeoportal_commons/models/sqlalchemy.py +13 -18
  73. c2cgeoportal_commons/models/static.py +212 -34
  74. c2cgeoportal_commons/py.typed +0 -0
  75. c2cgeoportal_commons/testing/__init__.py +11 -10
  76. c2cgeoportal_commons/testing/initializedb.py +12 -12
  77. {c2cgeoportal_commons-2.6.0.dist-info → c2cgeoportal_commons-2.8.1.180.dist-info}/METADATA +16 -11
  78. c2cgeoportal_commons-2.8.1.180.dist-info/RECORD +83 -0
  79. {c2cgeoportal_commons-2.6.0.dist-info → c2cgeoportal_commons-2.8.1.180.dist-info}/WHEEL +1 -1
  80. tests/conftest.py +0 -2
  81. c2cgeoportal_commons-2.6.0.dist-info/RECORD +0 -76
  82. {c2cgeoportal_commons-2.6.0.dist-info → c2cgeoportal_commons-2.8.1.180.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2016-2019, Camptocamp SA
1
+ # Copyright (c) 2016-2023, 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,8 @@
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
- """Merge 2.0 and master branches
28
+ """
29
+ Merge 2.0 and master branches.
31
30
 
32
31
  Revision ID: daf738d5bae4
33
32
  Revises: ('6a412d9437b1', '951ff84bd8ec')
@@ -41,9 +40,9 @@ branch_labels = None
41
40
  depends_on = None
42
41
 
43
42
 
44
- def upgrade():
45
- pass
43
+ def upgrade() -> None:
44
+ """Upgrade."""
46
45
 
47
46
 
48
- def downgrade():
49
- pass
47
+ def downgrade() -> None:
48
+ """Downgrade."""
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2018-2019, Camptocamp SA
1
+ # Copyright (c) 2018-2023, 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,8 @@
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
- """Merge 2.2 on 2.3
28
+ """
29
+ Merge 2.2 on 2.3.
31
30
 
32
31
  Revision ID: dba87f2647f9
33
32
  Revises: ('7530011a66a7', '809650bd04c3')
@@ -41,9 +40,9 @@ branch_labels = None
41
40
  depends_on = None
42
41
 
43
42
 
44
- def upgrade():
45
- pass
43
+ def upgrade() -> None:
44
+ """Upgrade."""
46
45
 
47
46
 
48
- def downgrade():
49
- pass
47
+ def downgrade() -> None:
48
+ """Downgrade."""
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2016-2019, Camptocamp SA
1
+ # Copyright (c) 2016-2023, 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
- """Add missing not null
28
+ # pylint: disable=no-member
29
+
30
+ """
31
+ Add missing not null.
31
32
 
32
33
  Revision ID: e004f76e951a
33
34
  Revises: ee25d267bf46
@@ -44,48 +45,30 @@ branch_labels = None
44
45
  depends_on = None
45
46
 
46
47
 
47
- def upgrade():
48
+ def upgrade() -> None:
49
+ """Upgrade."""
48
50
  schema = config["schema"]
49
51
 
50
52
  op.alter_column("layer_wmts", "url", nullable=False, schema=schema)
51
53
  op.alter_column("layer_wmts", "layer", nullable=False, schema=schema)
52
- op.execute(
53
- "UPDATE ONLY {schema}.layer_wmts SET image_type = 'image/png' where image_type IS NULL".format(
54
- schema=schema
55
- )
56
- )
54
+ op.execute(f"UPDATE ONLY {schema}.layer_wmts SET image_type = 'image/png' where image_type IS NULL")
57
55
  op.alter_column("layer_wmts", "image_type", nullable=False, schema=schema)
58
56
  op.alter_column("layer_wms", "ogc_server_id", nullable=False, schema=schema)
59
57
  op.alter_column("layer_wms", "layer", nullable=False, schema=schema)
60
- op.execute(
61
- "UPDATE ONLY {schema}.layer_wms SET time_mode = 'disabled' where time_mode IS NULL".format(
62
- schema=schema
63
- )
64
- )
58
+ op.execute(f"UPDATE ONLY {schema}.layer_wms SET time_mode = 'disabled' where time_mode IS NULL")
65
59
  op.alter_column("layer_wms", "time_mode", nullable=False, schema=schema)
66
- op.execute(
67
- "UPDATE ONLY {schema}.layer_wms SET time_widget = 'slider' where time_widget IS NULL".format(
68
- schema=schema
69
- )
70
- )
60
+ op.execute(f"UPDATE ONLY {schema}.layer_wms SET time_widget = 'slider' where time_widget IS NULL")
71
61
  op.alter_column("layer_wms", "time_widget", nullable=False, schema=schema)
72
- op.execute(
73
- "UPDATE ONLY {schema}.ogc_server SET image_type = 'image/png' where image_type IS NULL".format(
74
- schema=schema
75
- )
76
- )
62
+ op.execute(f"UPDATE ONLY {schema}.ogc_server SET image_type = 'image/png' where image_type IS NULL")
77
63
  op.alter_column("ogc_server", "image_type", nullable=False, schema=schema)
78
- op.execute(
79
- "UPDATE ONLY {schema}.ogc_server SET type = 'mapserver' where type IS NULL".format(schema=schema)
80
- )
64
+ op.execute(f"UPDATE ONLY {schema}.ogc_server SET type = 'mapserver' where type IS NULL")
81
65
  op.alter_column("ogc_server", "type", nullable=False, schema=schema)
82
- op.execute(
83
- "UPDATE ONLY {schema}.ogc_server SET auth = 'Standard auth' where auth IS NULL".format(schema=schema)
84
- )
66
+ op.execute(f"UPDATE ONLY {schema}.ogc_server SET auth = 'Standard auth' where auth IS NULL")
85
67
  op.alter_column("ogc_server", "auth", nullable=False, schema=schema)
86
68
 
87
69
 
88
- def downgrade():
70
+ def downgrade() -> None:
71
+ """Downgrade."""
89
72
  schema = config["schema"]
90
73
 
91
74
  op.alter_column("layer_wmts", "url", nullable=True, schema=schema)
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2016-2019, Camptocamp SA
1
+ # Copyright (c) 2016-2023, 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
- """Put the default WMS server in the servers part, add some constrains
28
+ # pylint: disable=no-member
29
+
30
+ """
31
+ Put the default WMS server in the servers part, add some constrains.
31
32
 
32
33
  Revision ID: e7e03dedade3
33
34
  Revises: daf738d5bae4
@@ -44,17 +45,16 @@ branch_labels = None
44
45
  depends_on = None
45
46
 
46
47
 
47
- def upgrade():
48
+ def upgrade() -> None:
49
+ """Upgrade."""
48
50
  schema = config["schema"]
49
51
 
50
52
  op.execute(
51
- """
53
+ f"""
52
54
  UPDATE "{schema}".ogc_server
53
55
  SET url = 'config://local/mapserv'
54
56
  WHERE url IS NULL
55
- """.format(
56
- schema=schema
57
- )
57
+ """
58
58
  )
59
59
 
60
60
  op.alter_column("ogc_server", "url", nullable=False, schema=schema)
@@ -63,7 +63,8 @@ def upgrade():
63
63
  op.create_unique_constraint("type_name_unique_treeitem", "treeitem", ["type", "name"], schema=schema)
64
64
 
65
65
 
66
- def downgrade():
66
+ def downgrade() -> None:
67
+ """Downgrade."""
67
68
  schema = config["schema"]
68
69
 
69
70
  op.alter_column("ogc_server", "url", nullable=True, schema=schema)
@@ -72,11 +73,9 @@ def downgrade():
72
73
  op.drop_constraint("type_name_unique_treeitem", "treeitem", schema=schema)
73
74
 
74
75
  op.execute(
75
- """
76
+ f"""
76
77
  UPDATE "{schema}".ogc_server
77
78
  SET url = NULL
78
79
  WHERE url = 'config://local/mapserv'
79
- """.format(
80
- schema=schema
81
- )
80
+ """
82
81
  )
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2019, Camptocamp SA
1
+ # Copyright (c) 2019-2021, 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
- """Cascade deletes to tsearch
28
+ # pylint: disable=no-member
29
+
30
+ """
31
+ Cascade deletes to tsearch.
31
32
 
32
33
  Revision ID: e85afd327ab3
33
34
  Revises: c75124553bf3
@@ -44,7 +45,8 @@ branch_labels = None
44
45
  depends_on = None
45
46
 
46
47
 
47
- def upgrade():
48
+ def upgrade() -> None:
49
+ """Upgrade."""
48
50
  schema = config["schema"]
49
51
 
50
52
  op.drop_constraint("tsearch_role_id_fkey", "tsearch", schema=schema, type_="foreignkey")
@@ -72,7 +74,8 @@ def upgrade():
72
74
  )
73
75
 
74
76
 
75
- def downgrade():
77
+ def downgrade() -> None:
78
+ """Downgrade."""
76
79
  schema = config["schema"]
77
80
 
78
81
  op.drop_constraint("tsearch_role_id_fkey", "tsearch", schema=schema, type_="foreignkey")
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2016-2019, Camptocamp SA
1
+ # Copyright (c) 2016-2023, 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
- """Add missing on delete cascade on layer tree
28
+ # pylint: disable=no-member
29
+
30
+ """
31
+ Add missing on delete cascade on layer tree.
31
32
 
32
33
  Revision ID: ec82a8906649
33
34
  Revises: e7e03dedade3
@@ -44,13 +45,14 @@ branch_labels = None
44
45
  depends_on = None
45
46
 
46
47
 
47
- def upgrade():
48
+ def upgrade() -> None:
49
+ """Upgrade."""
48
50
  schema = config["schema"]
49
51
 
50
52
  for source, dest in [("layer_wmts", "layer"), ("layerv1", "layer"), ("theme", "treegroup")]:
51
- op.drop_constraint("{}_id_fkey".format(source), source, schema=schema)
53
+ op.drop_constraint(f"{source}_id_fkey", source, schema=schema)
52
54
  op.create_foreign_key(
53
- "{}_id_fkey".format(source),
55
+ f"{source}_id_fkey",
54
56
  source,
55
57
  source_schema=schema,
56
58
  local_cols=["id"],
@@ -61,13 +63,14 @@ def upgrade():
61
63
  )
62
64
 
63
65
 
64
- def downgrade():
66
+ def downgrade() -> None:
67
+ """Downgrade."""
65
68
  schema = config["schema"]
66
69
 
67
70
  for source, dest in [("layer_wmts", "layer"), ("layerv1", "layer"), ("theme", "treegroup")]:
68
- op.drop_constraint("{}_id_fkey".format(source), source, schema=schema)
71
+ op.drop_constraint(f"{source}_id_fkey", source, schema=schema)
69
72
  op.create_foreign_key(
70
- "{}_id_fkey".format(source),
73
+ f"{source}_id_fkey",
71
74
  source,
72
75
  source_schema=schema,
73
76
  local_cols=["id"],
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2016-2019, Camptocamp SA
1
+ # Copyright (c) 2016-2023, 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
- """main interface => desktop
28
+ # pylint: disable=no-member
29
+
30
+ """
31
+ main interface => desktop.
31
32
 
32
33
  Revision ID: ee25d267bf46
33
34
  Revises: 596ba21e3833
@@ -44,19 +45,15 @@ branch_labels = None
44
45
  depends_on = None
45
46
 
46
47
 
47
- def upgrade():
48
+ def upgrade() -> None:
49
+ """Upgrade."""
48
50
  schema = config["schema"]
49
51
 
50
- op.execute(
51
- "UPDATE ONLY {schema}.interface AS i "
52
- "SET name = 'desktop' where name = 'main'".format(schema=schema)
53
- )
52
+ op.execute(f"UPDATE ONLY {schema}.interface AS i SET name = 'desktop' where name = 'main'")
54
53
 
55
54
 
56
- def downgrade():
55
+ def downgrade() -> None:
56
+ """Downgrade."""
57
57
  schema = config["schema"]
58
58
 
59
- op.execute(
60
- "UPDATE ONLY {schema}.interface AS i "
61
- "SET name = 'main' where name = 'desktop'".format(schema=schema)
62
- )
59
+ op.execute(f"UPDATE ONLY {schema}.interface AS i SET name = 'main' where name = 'desktop'")
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2019, Camptocamp SA
1
+ # Copyright (c) 2019-2023, 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,8 @@
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
- """Merge 2.4 and master branches
28
+ """
29
+ Merge 2.4 and master branches.
31
30
 
32
31
  Revision ID: eeb345672454
33
32
  Revises: ('78fd093c8393', '56dc90838d90')
@@ -42,9 +41,9 @@ branch_labels = None
42
41
  depends_on = None
43
42
 
44
43
 
45
- def upgrade():
46
- pass
44
+ def upgrade() -> None:
45
+ """Upgrade."""
47
46
 
48
47
 
49
- def downgrade():
50
- pass
48
+ def downgrade() -> None:
49
+ """Downgrade."""
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2019, Camptocamp SA
1
+ # Copyright (c) 2019-2021, 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
- """Add tech_data hstor column
28
+ # pylint: disable=no-member
29
+
30
+ """
31
+ Add tech_data hstor column.
31
32
 
32
33
  Revision ID: 0c640a58a09a
33
34
  Revises: ae5e88f35669
@@ -46,13 +47,15 @@ branch_labels = None
46
47
  depends_on = None
47
48
 
48
49
 
49
- def upgrade():
50
+ def upgrade() -> None:
51
+ """Upgrade."""
50
52
  staticschema = config["schema_static"]
51
53
 
52
54
  op.add_column("user", Column("tech_data", HSTORE), schema=staticschema)
53
55
 
54
56
 
55
- def downgrade():
57
+ def downgrade() -> None:
58
+ """Downgrade."""
56
59
  staticschema = config["schema_static"]
57
60
 
58
61
  op.drop_column("user", "tech_data", schema=staticschema)
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2020, Camptocamp SA
1
+ # Copyright (c) 2020-2021, 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
- """Add missing delete cascades
28
+ # pylint: disable=no-member
29
+
30
+ """
31
+ Add missing delete cascades.
31
32
 
32
33
  Revision ID: 107b81f5b9fe
33
34
  Revises: bd029dbfc11a
@@ -44,7 +45,8 @@ branch_labels = None
44
45
  depends_on = None
45
46
 
46
47
 
47
- def upgrade():
48
+ def upgrade() -> None:
49
+ """Upgrade."""
48
50
  staticschema = config["schema_static"]
49
51
 
50
52
  op.drop_constraint("user_role_user_id_fkey", "user_role", schema=staticschema, type_="foreignkey")
@@ -60,7 +62,8 @@ def upgrade():
60
62
  )
61
63
 
62
64
 
63
- def downgrade():
65
+ def downgrade() -> None:
66
+ """Downgrade."""
64
67
  staticschema = config["schema_static"]
65
68
 
66
69
  op.drop_constraint("user_role_user_id_fkey", "user_role", schema=staticschema, type_="foreignkey")
@@ -1,5 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- # Copyright (c) 2018-2019, Camptocamp SA
1
+ # Copyright (c) 2018-2023, Camptocamp SA
3
2
  # All rights reserved.
4
3
 
5
4
  # Redistribution and use in source and binary forms, with or without
@@ -26,10 +25,10 @@
26
25
  # of the authors and should not be interpreted as representing official policies,
27
26
  # either expressed or implied, of the FreeBSD Project.
28
27
 
28
+ # pylint: disable=no-member
29
29
 
30
30
  """
31
- Add columns last_login, expire_on (both datetime) and deactivated (boolean) on
32
- table main_static."user".
31
+ Add columns last_login, expire_on (both datetime) and deactivated (boolean) on table main_static."user".
33
32
 
34
33
  Revision ID: 1857owc78a07
35
34
  Revises: 5472fbc19f39
@@ -45,7 +44,8 @@ revision = "1857owc78a07"
45
44
  down_revision = "5472fbc19f39"
46
45
 
47
46
 
48
- def upgrade():
47
+ def upgrade() -> None:
48
+ """Upgrade."""
49
49
  staticschema = config["schema_static"]
50
50
 
51
51
  # Instructions
@@ -54,7 +54,8 @@ def upgrade():
54
54
  op.add_column("user", Column("deactivated", Boolean, default=False), schema=staticschema)
55
55
 
56
56
 
57
- def downgrade():
57
+ def downgrade() -> None:
58
+ """Downgrade."""
58
59
  staticschema = config["schema_static"]
59
60
 
60
61
  # Instructions
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2015-2019, Camptocamp SA
1
+ # Copyright (c) 2015-2023, Camptocamp SA
4
2
  # All rights reserved.
5
3
 
6
4
  # Redistribution and use in source and binary forms, with or without
@@ -27,8 +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
 
28
+ # pylint: disable=no-member
30
29
 
31
- """Move user table to static schema
30
+ """
31
+ Move user table to static schema.
32
32
 
33
33
  Revision ID: 1da396a88908
34
34
  Revises: 3f89a7d71a5e
@@ -47,16 +47,18 @@ revision = "1da396a88908"
47
47
  down_revision = "3f89a7d71a5e"
48
48
 
49
49
 
50
- def upgrade():
50
+ def upgrade() -> None:
51
+ """Upgrade."""
51
52
  schema = config["schema"]
52
53
  staticschema = config["schema_static"]
53
54
  parentschema = config.get("parentschema")
54
55
 
55
56
  engine = op.get_bind().engine
56
- if type(engine).__name__ != "MockConnection" and op.get_context().dialect.has_table(
57
- engine, "user", schema=staticschema
58
- ): # pragma: no cover
59
- return
57
+ with engine.connect() as connection:
58
+ if type(engine).__name__ != "MockConnection" and op.get_context().dialect.has_table(
59
+ connection, "user", schema=staticschema
60
+ ):
61
+ return
60
62
 
61
63
  op.create_table(
62
64
  "user",
@@ -72,13 +74,11 @@ def upgrade():
72
74
  parent_column = ""
73
75
  parent_select = ""
74
76
  parent_join = ""
75
- if parentschema is not None and parentschema != "": # pragma: no cover
77
+ if parentschema is not None and parentschema != "":
76
78
  op.add_column("user", Column("parent_role_name", String), schema=staticschema)
77
79
  parent_column = ", parent_role_name"
78
80
  parent_select = ", pr.name"
79
- parent_join = "LEFT OUTER JOIN {parentschema!s}.role AS pr ON (pr.id = u.parent_role_id)".format(
80
- parentschema=parentschema
81
- )
81
+ parent_join = f"LEFT OUTER JOIN {parentschema!s}.role AS pr ON (pr.id = u.parent_role_id)"
82
82
 
83
83
  try:
84
84
  op.execute(
@@ -102,11 +102,12 @@ def upgrade():
102
102
  op.execute(
103
103
  "INSERT INTO %(staticschema)s.user (type, username, email, password, role) "
104
104
  "VALUES ( 'user', 'admin', 'info@example.com', '%(pass)s', 'role_admin')"
105
- % {"staticschema": staticschema, "pass": sha1("admin".encode("utf-8")).hexdigest()}
105
+ % {"staticschema": staticschema, "pass": sha1(b"admin").hexdigest()} # nosec
106
106
  )
107
107
 
108
108
 
109
- def downgrade():
109
+ def downgrade() -> None:
110
+ """Downgrade."""
110
111
  schema = config["schema"]
111
112
  staticschema = config.get("schema_static")
112
113
  parentschema = config.get("parentschema")
@@ -125,15 +126,13 @@ def downgrade():
125
126
  parent_column = ""
126
127
  parent_select = ""
127
128
  parent_join = ""
128
- if parentschema is not None and parentschema != "": # pragma: no cover
129
+ if parentschema is not None and parentschema != "":
129
130
  op.add_column(
130
131
  "user", Column("parent_role_id", Integer, ForeignKey(parentschema + ".role.id")), schema=schema
131
132
  )
132
133
  parent_column = ", parent_role_id"
133
134
  parent_select = ", pr.id"
134
- parent_join = "LEFT OUTER JOIN {parentschema}.role AS pr ON (pr.name = u.parent_role_name)".format(
135
- parentschema=parentschema
136
- )
135
+ parent_join = f"LEFT OUTER JOIN {parentschema}.role AS pr ON (pr.name = u.parent_role_name)"
137
136
 
138
137
  op.execute(
139
138
  "INSERT INTO %(schema)s.user "
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- # Copyright (c) 2014-2019, Camptocamp SA
1
+ # Copyright (c) 2014-2023, Camptocamp SA
4
2
  # All rights reserved.
5
3
 
6
4
  # Redistribution and use in source and binary forms, with or without
@@ -27,8 +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
 
28
+ # pylint: disable=no-member
30
29
 
31
- """Alter_column_url_to_remove_limitation
30
+ """
31
+ Alter_column_url_to_remove_limitation.
32
32
 
33
33
  Revision ID: 3f89a7d71a5e
34
34
  Revises:
@@ -44,10 +44,11 @@ revision = "3f89a7d71a5e"
44
44
  down_revision = None
45
45
 
46
46
 
47
- def upgrade():
47
+ def upgrade() -> None:
48
+ """Upgrade."""
48
49
  schema = config["schema_static"]
49
50
  op.alter_column("shorturl", "url", type_=types.Unicode, schema=schema)
50
51
 
51
52
 
52
- def downgrade():
53
- pass
53
+ def downgrade() -> None:
54
+ """Downgrade."""