c2cgeoportal-admin 2.8.1.181__py3-none-any.whl → 2.9rc2__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 (49) hide show
  1. c2cgeoportal_admin/__init__.py +14 -6
  2. c2cgeoportal_admin/lib/{lingua_extractor.py → lingva_extractor.py} +6 -6
  3. c2cgeoportal_admin/lib/ogcserver_synchronizer.py +6 -5
  4. c2cgeoportal_admin/routes.py +12 -3
  5. c2cgeoportal_admin/schemas/dimensions.py +4 -2
  6. c2cgeoportal_admin/schemas/functionalities.py +9 -12
  7. c2cgeoportal_admin/schemas/interfaces.py +7 -3
  8. c2cgeoportal_admin/schemas/metadata.py +13 -13
  9. c2cgeoportal_admin/schemas/restriction_areas.py +5 -3
  10. c2cgeoportal_admin/schemas/roles.py +7 -3
  11. c2cgeoportal_admin/schemas/treegroup.py +14 -10
  12. c2cgeoportal_admin/schemas/treeitem.py +2 -2
  13. c2cgeoportal_admin/static/theme.css +3 -0
  14. c2cgeoportal_admin/views/dimension_layers.py +11 -7
  15. c2cgeoportal_admin/views/functionalities.py +25 -18
  16. c2cgeoportal_admin/views/interfaces.py +22 -15
  17. c2cgeoportal_admin/views/layer_groups.py +33 -20
  18. c2cgeoportal_admin/views/layers.py +12 -9
  19. c2cgeoportal_admin/views/layers_cog.py +135 -0
  20. c2cgeoportal_admin/views/layers_vectortiles.py +42 -27
  21. c2cgeoportal_admin/views/layers_wms.py +47 -32
  22. c2cgeoportal_admin/views/layers_wmts.py +46 -32
  23. c2cgeoportal_admin/views/layertree.py +9 -8
  24. c2cgeoportal_admin/views/logged_views.py +15 -12
  25. c2cgeoportal_admin/views/logs.py +9 -8
  26. c2cgeoportal_admin/views/oauth2_clients.py +26 -22
  27. c2cgeoportal_admin/views/ogc_servers.py +48 -34
  28. c2cgeoportal_admin/views/restriction_areas.py +29 -19
  29. c2cgeoportal_admin/views/roles.py +29 -19
  30. c2cgeoportal_admin/views/themes.py +35 -24
  31. c2cgeoportal_admin/views/themes_ordering.py +11 -11
  32. c2cgeoportal_admin/views/treeitems.py +13 -11
  33. c2cgeoportal_admin/views/users.py +37 -22
  34. c2cgeoportal_admin/widgets.py +3 -3
  35. {c2cgeoportal_admin-2.8.1.181.dist-info → c2cgeoportal_admin-2.9rc2.dist-info}/METADATA +3 -12
  36. {c2cgeoportal_admin-2.8.1.181.dist-info → c2cgeoportal_admin-2.9rc2.dist-info}/RECORD +48 -46
  37. {c2cgeoportal_admin-2.8.1.181.dist-info → c2cgeoportal_admin-2.9rc2.dist-info}/WHEEL +1 -1
  38. c2cgeoportal_admin-2.9rc2.dist-info/entry_points.txt +5 -0
  39. tests/__init__.py +13 -8
  40. tests/conftest.py +20 -10
  41. tests/test_layers_cog.py +243 -0
  42. tests/test_layers_vectortiles.py +2 -7
  43. tests/{test_lingua_extractor_config.py → test_lingva_extractor_config.py} +3 -3
  44. tests/test_logs.py +3 -4
  45. tests/test_oauth2_clients.py +3 -2
  46. tests/test_role.py +3 -2
  47. tests/test_user.py +8 -2
  48. c2cgeoportal_admin-2.8.1.181.dist-info/entry_points.txt +0 -6
  49. {c2cgeoportal_admin-2.8.1.181.dist-info → c2cgeoportal_admin-2.9rc2.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2017-2023, Camptocamp SA
1
+ # Copyright (c) 2017-2024, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -26,10 +26,18 @@
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
28
 
29
+ import os
29
30
  from functools import partial
30
31
 
31
32
  from c2cgeoform.schema import GeoFormSchemaNode
32
- from c2cgeoform.views.abstract_views import ListField
33
+ from c2cgeoform.views.abstract_views import (
34
+ DeleteResponse,
35
+ GridResponse,
36
+ IndexResponse,
37
+ ListField,
38
+ ObjectResponse,
39
+ SaveResponse,
40
+ )
33
41
  from deform.widget import FormWidget
34
42
  from passwordgenerator import pwgenerator
35
43
  from pyramid.httpexceptions import HTTPFound
@@ -50,18 +58,23 @@ base_schema.add_unique_validator(User.username, User.id)
50
58
 
51
59
  settings_role = aliased(Role)
52
60
 
61
+ _OPENID_CONNECT_ENABLED = os.environ.get("OPENID_CONNECT_ENABLED", "false").lower() in ("true", "yes", "1")
62
+
53
63
 
54
64
  @view_defaults(match_param="table=users")
55
- class UserViews(LoggedViews):
65
+ class UserViews(LoggedViews[User]):
56
66
  """The admin user view."""
57
67
 
58
68
  _list_fields = [
59
69
  _list_field("id"),
60
- _list_field("username"),
70
+ *([_list_field("username")] if not _OPENID_CONNECT_ENABLED else []),
71
+ _list_field("display_name"),
61
72
  _list_field("email"),
62
- _list_field("last_login"),
63
- _list_field("expire_on"),
64
- _list_field("deactivated"),
73
+ *(
74
+ [_list_field("last_login"), _list_field("expire_on"), _list_field("deactivated")]
75
+ if not _OPENID_CONNECT_ENABLED
76
+ else []
77
+ ),
65
78
  _list_field(
66
79
  "settings_role",
67
80
  renderer=lambda user: user.settings_role.name if user.settings_role else "",
@@ -85,25 +98,25 @@ class UserViews(LoggedViews):
85
98
  self._request.dbsession.query(User)
86
99
  .distinct()
87
100
  .outerjoin(settings_role, settings_role.id == User.settings_role_id)
88
- .outerjoin("roles")
89
- .options(subqueryload("settings_role"))
90
- .options(subqueryload("roles"))
101
+ .outerjoin(User.roles)
102
+ .options(subqueryload(User.settings_role))
103
+ .options(subqueryload(User.roles))
91
104
  )
92
105
 
93
- @view_config(route_name="c2cgeoform_index", renderer="../templates/index.jinja2")
94
- def index(self):
106
+ @view_config(route_name="c2cgeoform_index", renderer="../templates/index.jinja2") # type: ignore[misc]
107
+ def index(self) -> IndexResponse:
95
108
  return super().index()
96
109
 
97
- @view_config(route_name="c2cgeoform_grid", renderer="fast_json")
98
- def grid(self):
110
+ @view_config(route_name="c2cgeoform_grid", renderer="fast_json") # type: ignore[misc]
111
+ def grid(self) -> GridResponse:
99
112
  return super().grid()
100
113
 
101
- @view_config(route_name="c2cgeoform_item", request_method="GET", renderer="../templates/edit.jinja2")
102
- def view(self):
114
+ @view_config(route_name="c2cgeoform_item", request_method="GET", renderer="../templates/edit.jinja2") # type: ignore[misc]
115
+ def view(self) -> ObjectResponse:
103
116
  return super().edit()
104
117
 
105
- @view_config(route_name="c2cgeoform_item", request_method="POST", renderer="../templates/edit.jinja2")
106
- def save(self):
118
+ @view_config(route_name="c2cgeoform_item", request_method="POST", renderer="../templates/edit.jinja2") # type: ignore[misc]
119
+ def save(self) -> SaveResponse:
107
120
  if self._is_new():
108
121
  response = super().save()
109
122
 
@@ -111,9 +124,11 @@ class UserViews(LoggedViews):
111
124
  password = pwgenerator.generate()
112
125
 
113
126
  user = self._obj
127
+ assert user is not None
114
128
  user.password = password
115
129
  user.is_password_changed = False
116
130
  user = self._request.dbsession.merge(user)
131
+ assert user is not None
117
132
  self._request.dbsession.flush()
118
133
 
119
134
  send_email_config(
@@ -130,12 +145,12 @@ class UserViews(LoggedViews):
130
145
 
131
146
  return super().save()
132
147
 
133
- @view_config(route_name="c2cgeoform_item", request_method="DELETE", renderer="fast_json")
134
- def delete(self):
148
+ @view_config(route_name="c2cgeoform_item", request_method="DELETE", renderer="fast_json") # type: ignore[misc]
149
+ def delete(self) -> DeleteResponse:
135
150
  return super().delete()
136
151
 
137
- @view_config(
152
+ @view_config( # type: ignore[misc]
138
153
  route_name="c2cgeoform_item_duplicate", request_method="GET", renderer="../templates/edit.jinja2"
139
154
  )
140
- def duplicate(self):
155
+ def duplicate(self) -> ObjectResponse:
141
156
  return super().duplicate()
@@ -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
- from typing import Any, Optional
28
+ from typing import Any
29
29
 
30
30
  import colander
31
31
  import pyramid.request
@@ -90,13 +90,13 @@ class ChildWidget(MappingWidget): # type: ignore
90
90
  model = TreeItem
91
91
  label_field = "name"
92
92
 
93
- def icon_class(self, child: Any) -> Optional[str]: # pylint: disable=useless-return
93
+ def icon_class(self, child: Any) -> str | None: # pylint: disable=useless-return
94
94
  del child
95
95
  return None
96
96
 
97
97
  def edit_url( # pylint: disable=useless-return
98
98
  self, request: pyramid.request.Request, child: Any
99
- ) -> Optional[str]:
99
+ ) -> str | None:
100
100
  del request
101
101
  del child
102
102
  return None
@@ -1,13 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: c2cgeoportal-admin
3
- Version: 2.8.1.181
3
+ Version: 2.9rc2
4
4
  Summary: c2cgeoportal admin
5
5
  Home-page: https://github.com/camptocamp/c2cgeoportal/
6
6
  Author: Camptocamp
7
7
  Author-email: info@camptocamp.com
8
- License: UNKNOWN
9
8
  Keywords: web gis geoportail c2cgeoportal geocommune pyramid
10
- Platform: UNKNOWN
11
9
  Classifier: Development Status :: 6 - Mature
12
10
  Classifier: Environment :: Web Environment
13
11
  Classifier: Framework :: Pyramid
@@ -16,28 +14,23 @@ Classifier: License :: OSI Approved :: BSD License
16
14
  Classifier: Operating System :: OS Independent
17
15
  Classifier: Programming Language :: Python
18
16
  Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.10
20
18
  Classifier: Topic :: Scientific/Engineering :: GIS
21
19
  Classifier: Typing :: Typed
20
+ Requires-Python: >=3.10
22
21
  Description-Content-Type: text/markdown
23
- Requires-Dist: babel (>=2.9.1)
24
22
  Requires-Dist: c2cgeoform
25
23
  Requires-Dist: c2cwsgiutils
26
- Requires-Dist: certifi (>=2022.12.7)
27
24
  Requires-Dist: colander
28
25
  Requires-Dist: deform
29
- Requires-Dist: idna (>=3.7)
30
26
  Requires-Dist: passwordgenerator
31
- Requires-Dist: pygments (>=2.15.0)
32
27
  Requires-Dist: pyproj
33
28
  Requires-Dist: pyramid
34
29
  Requires-Dist: pyramid-debugtoolbar
35
30
  Requires-Dist: pyramid-jinja2
36
31
  Requires-Dist: pyramid-tm
37
- Requires-Dist: requests (>=2.32.0)
38
32
  Requires-Dist: sqlalchemy
39
33
  Requires-Dist: translationstring
40
- Requires-Dist: urllib3 (>=1.26.17)
41
34
  Requires-Dist: zope.event
42
35
 
43
36
  # c2cgeoportal admin interface
@@ -52,5 +45,3 @@ make serve
52
45
  ```
53
46
 
54
47
  Now open http://localhost:8888/admin/ in your favorite browser.
55
-
56
-
@@ -1,23 +1,23 @@
1
- c2cgeoportal_admin/__init__.py,sha256=uuW2AC81qIXn7bH7MLHzf9fhEK4liGg3Zi-TosyzKNs,5478
1
+ c2cgeoportal_admin/__init__.py,sha256=HVSQ-CwK5aR9URA-NVH7JlYHGU49xT5vARiTkdxpV70,5767
2
2
  c2cgeoportal_admin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- c2cgeoportal_admin/routes.py,sha256=tgLP5uKhgX80a2gLCpu6C92UtmqwVkOkmJ-tPxEP3QE,4712
3
+ c2cgeoportal_admin/routes.py,sha256=oja-Seyn08geema9lKJEVU-bPzuT8RaNBfUORDxEm6w,5302
4
4
  c2cgeoportal_admin/subscribers.py,sha256=P1CaccDTpuxrWak_gMN2qBurz3OrAZ6aZ1LA7P3avu8,2430
5
- c2cgeoportal_admin/widgets.py,sha256=bjMlC4mqx_bAjzIzzu-zqdQ7bc6tVo7mKOMbpmbeN38,6108
5
+ c2cgeoportal_admin/widgets.py,sha256=8bozaTGBZKxDIMWbkHU1eD0MmOQ9KMOn21PDLYbQGFs,6092
6
6
  c2cgeoportal_admin/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- c2cgeoportal_admin/lib/lingua_extractor.py,sha256=Dw4vo46TcUnJ7vvxgFezPYidfEdL2pHJUM0qxAaJ1KE,3380
8
- c2cgeoportal_admin/lib/ogcserver_synchronizer.py,sha256=Px9SzBAv5qDTtF1xu6IRzr1u77TA8eAC3cjgI0Rxgks,15515
7
+ c2cgeoportal_admin/lib/lingva_extractor.py,sha256=5XsUHeVHnGF6GmD83shaTXasigGXtDXwgnswU0xA410,3355
8
+ c2cgeoportal_admin/lib/ogcserver_synchronizer.py,sha256=AFr0TbI_l7QTf9oNyO6rFEy6Ix096R2V0EFYcw-ArIc,15536
9
9
  c2cgeoportal_admin/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- c2cgeoportal_admin/schemas/dimensions.py,sha256=rPMEuIdGiVGS5e0xqXUu-COVKlrWg9rpp-xe-8aHbOQ,2290
11
- c2cgeoportal_admin/schemas/functionalities.py,sha256=AptqKn2oyy74qivzihNfeNvmaDILsl36bSoJdSNXh9Y,3941
12
- c2cgeoportal_admin/schemas/interfaces.py,sha256=0NCRDZOqbw7Bwj-l3GNsVwYDHck4F0q1fCSo1kTYoOY,2578
13
- c2cgeoportal_admin/schemas/metadata.py,sha256=EOr9hWYBPBJ3iaUmPFgtWnBaNWadX0g9UQ0eeJ6N84E,8991
14
- c2cgeoportal_admin/schemas/restriction_areas.py,sha256=48hFUgFznl_1bYsl490YSXLbXfjCY_f6gURQtB_7eIk,2598
15
- c2cgeoportal_admin/schemas/roles.py,sha256=4JJrgZNKsj_wru_YGOWxZTEXGVm0hahbAkYf2aePGzI,2507
16
- c2cgeoportal_admin/schemas/treegroup.py,sha256=8_aDM5xhtT7m-amaccEgH8T5O-SoRtFYIcGZ01VwHr0,7036
17
- c2cgeoportal_admin/schemas/treeitem.py,sha256=qnjrLd2LD7NCBjXqzw7aRn83cw_hYZbepJdLzOz0rBk,2117
10
+ c2cgeoportal_admin/schemas/dimensions.py,sha256=zpynF2qMISalyPihl0ZWsRFJBYwSUsbeGLQZjxURW1k,2319
11
+ c2cgeoportal_admin/schemas/functionalities.py,sha256=JecG1DYagM_Bgd7sMj0clN-4CAuYZEdELwDXlLRLBZs,3852
12
+ c2cgeoportal_admin/schemas/interfaces.py,sha256=N_b1LQ0Ur2i09dprnLLqXrcEq1p7uaKZJhaQpW7mOKc,2662
13
+ c2cgeoportal_admin/schemas/metadata.py,sha256=cp-QJkUf0zH0s6rBgV3uIZuXhHVFG5E8mF4J1ty2c6c,8897
14
+ c2cgeoportal_admin/schemas/restriction_areas.py,sha256=3zB_Uq9CshCKz99K4cnmit6gtqzuunCJc7vHTuwiUK8,2633
15
+ c2cgeoportal_admin/schemas/roles.py,sha256=YyRaStlu1IJwB5gRHlvS285twSy2xxatNOqV9klq1s8,2591
16
+ c2cgeoportal_admin/schemas/treegroup.py,sha256=pLBIGBeaCmsAUMC4yCFCdSkYqLytG38qVygYqNr_AX8,7150
17
+ c2cgeoportal_admin/schemas/treeitem.py,sha256=VhGhpG8VcsT-3dnnNlln-uVlsqjwJQXbg6Ap1tEanMI,2146
18
18
  c2cgeoportal_admin/static/layertree.css,sha256=tk54KGW0yRRmdrY35gOCZG3qTsqWtGNEwvBYPQKhaVs,3177
19
19
  c2cgeoportal_admin/static/navbar.css,sha256=QIaAQsb4n17OfwdKEQdmNDVPCP23Yu-oGW4xsSaHyW0,2307
20
- c2cgeoportal_admin/static/theme.css,sha256=eHtBEJcBtDhyZJvCKNxE5hgril0VpLtcDKfNFdgCSVw,2025
20
+ c2cgeoportal_admin/static/theme.css,sha256=3knC4gpPnEwLF0-jEJze15C1hm1K87aCpxGyqdjrLxw,2068
21
21
  c2cgeoportal_admin/templates/404.jinja2,sha256=KSpqCNFwv37rKSmX6kL_VvCnn5egcT1eRD6kIKwWx34,1807
22
22
  c2cgeoportal_admin/templates/edit.jinja2,sha256=rkBQiz0JZdL7VDq8XrhRLTv6JaiFt_QB8CwP3NMHWQY,1302
23
23
  c2cgeoportal_admin/templates/home.jinja2,sha256=WDQwmBGMZxsiOLw9YeYPLuca_mjjntjrTh529euzd1o,1516
@@ -42,54 +42,56 @@ c2cgeoportal_admin/templates/widgets/role_fields.pt,sha256=gVd9eRYaqw8fGmZauqEUS
42
42
  c2cgeoportal_admin/templates/widgets/theme_fields.pt,sha256=68G1Ya8-Dc6pCeP-taQ0ofCIpnY_v0rouazkFhfQflU,3083
43
43
  c2cgeoportal_admin/templates/widgets/user_fields.pt,sha256=twmajhUYL1xa47Eu-iATKifNPA5lu3SGpqdKajH6gL8,1753
44
44
  c2cgeoportal_admin/views/__init__.py,sha256=jtI6CdoXJwizznjwb8ClYySgq4kbwhTIJYutSw89PAw,683
45
- c2cgeoportal_admin/views/dimension_layers.py,sha256=jupwqX_kO37ukcWE-SsO290JdKENEmfoYxk4sRWb25Y,2598
46
- c2cgeoportal_admin/views/functionalities.py,sha256=4oZYgs2_M0Usb3GBi40gCP6XvTbR-1PhCDZXiBnhsuk,4031
45
+ c2cgeoportal_admin/views/dimension_layers.py,sha256=WL3CqfAY8mref9cen1lCF5vADg_csf2Pp5zeEYX1ZXg,2778
46
+ c2cgeoportal_admin/views/functionalities.py,sha256=F51rdqVqbdWx1iNz8DHauhh3B8f6x6lEidaskxBn1so,4379
47
47
  c2cgeoportal_admin/views/home.py,sha256=h_hJWIKpzJeSmXl58J0nvZdEg7avSYOOVUEEnlV-r0k,1943
48
- c2cgeoportal_admin/views/interfaces.py,sha256=gzIRrd4D64iSH7NVaR-9oQh8-iMzjZOW5QfTfpQeYU4,3494
49
- c2cgeoportal_admin/views/layer_groups.py,sha256=Zcdr26jyo4ZZw7sr6hYOjo6PuI9-StQ5KQ7OlIxSEtY,3956
50
- c2cgeoportal_admin/views/layers.py,sha256=xjvcRvKVpeD-LRuVwE8PGkDT-Kih9ADX0beEDcOP1bE,3039
51
- c2cgeoportal_admin/views/layers_vectortiles.py,sha256=lREdMc7bo2TVqdf-s6MzNXZoauReqFS_K-Hng49NUT4,4932
52
- c2cgeoportal_admin/views/layers_wms.py,sha256=Kpgr-eWME9zxahkf-re1w6wkToKBqyInmqd_DHhj9Kc,8040
53
- c2cgeoportal_admin/views/layers_wmts.py,sha256=HNZalKLLhPF7aXLxuFP07yr9-MGnJTg-CVD-GeokvMM,7815
54
- c2cgeoportal_admin/views/layertree.py,sha256=plb5fL9vTaSe9EFp8VmUWl5iD9FuiQ-3TuStKAGjIKo,8587
55
- c2cgeoportal_admin/views/logged_views.py,sha256=_XHoIl7Lw3SV_1T0c0JUeIhkluzNnjNrSUgimfk993E,3169
56
- c2cgeoportal_admin/views/logs.py,sha256=I4ZnfNtBZmriDLIzLpLiX5HPm3Y1UvIQehemPbC2rL0,3616
57
- c2cgeoportal_admin/views/oauth2_clients.py,sha256=lfMSwZW7pybQx3PR1btRY7XFLfx1TOx7ooVgllOqK-s,3798
58
- c2cgeoportal_admin/views/ogc_servers.py,sha256=nGTs_pDr2knS_NAakqvxmjZE2ulrWxn2puWA_uNqgaY,9412
59
- c2cgeoportal_admin/views/restriction_areas.py,sha256=uzfQQVRFCP-OCg1sdGzQCTkO35C1H8DZNMWIquFQqRw,5578
60
- c2cgeoportal_admin/views/roles.py,sha256=VP0OEsW2_l99YnxGO5mdOkvPBs4Hs3nyRSbetIKtx14,5887
61
- c2cgeoportal_admin/views/themes.py,sha256=mxpf56KXwCKG5tCYgV7xgPtQqlCU67iOBOLB7cHD-Hc,5710
62
- c2cgeoportal_admin/views/themes_ordering.py,sha256=NYN3I2tDwLW5E4G-695DwV0dCbHUAObWVFYZ8Bir1-o,5590
63
- c2cgeoportal_admin/views/treeitems.py,sha256=C-vjScmb_HI5QOowx3MGZBJqAHDkGTG90vshPG7FvgA,3889
64
- c2cgeoportal_admin/views/users.py,sha256=sXCgVluLLnbbQTG8Q7tmaVfnEcHj5fBiHFCG7owVp1w,5439
65
- tests/__init__.py,sha256=oo8kqGfoSh8AV0HhTqQfC0izcIQ8ZQPkNmONSEUUby4,9556
66
- tests/conftest.py,sha256=ah7JmR2epDZul2rmMH5wuUzkSpXIjm8dd-cgGjK6_k0,2119
48
+ c2cgeoportal_admin/views/interfaces.py,sha256=psp5dw22rI3enY9AS0aIspHBdv-sVzSPBQKGIhW3-Hw,3844
49
+ c2cgeoportal_admin/views/layer_groups.py,sha256=xQiEkO7LuNy0FiwfHZa1XwaoMvr9UE2bLpckOtdyuMM,4489
50
+ c2cgeoportal_admin/views/layers.py,sha256=JDEO8hEIPhRxZVpxyT_0FU6gWCgREllw5O9qBCCxipU,3248
51
+ c2cgeoportal_admin/views/layers_cog.py,sha256=tFljZufefGP8YZvidAhUA5cgwbO1R2D7wXdQdS1EX1I,5627
52
+ c2cgeoportal_admin/views/layers_vectortiles.py,sha256=fTNaGGt7ZIX9wydZvED6mp1B8iBtt-qbywv2MqQgV_Q,5617
53
+ c2cgeoportal_admin/views/layers_wms.py,sha256=kjhH4TWnVnH81J__vcbyST2qEMSz3qHOxcEL8ELvLuU,8335
54
+ c2cgeoportal_admin/views/layers_wmts.py,sha256=Kb-j_yPEJycBYh5E-D-eP3xEhuzraotNL9bLup7GoNM,8080
55
+ c2cgeoportal_admin/views/layertree.py,sha256=sWDDTqiBIl9LyGvzChI0hnBSP_IqjTNcsJpq_pk52V8,8605
56
+ c2cgeoportal_admin/views/logged_views.py,sha256=Yg8HnrLCog4geNWOjkhF_Zo2ByOKuevdVT8xLd9x5Ow,3335
57
+ c2cgeoportal_admin/views/logs.py,sha256=N1I0gqzoqbEtkOsP0EhrlEWsDYuiuKQ46_YeKy7zFHs,3776
58
+ c2cgeoportal_admin/views/oauth2_clients.py,sha256=RC_vrMQaYGujN97wHihQXrO_0K7CrcFF1rSI0-dHZlg,3840
59
+ c2cgeoportal_admin/views/ogc_servers.py,sha256=kIhlZ7Sp_mdZUlyl2h4foTTgkevWrbZb_chLZUXEF1o,9716
60
+ c2cgeoportal_admin/views/restriction_areas.py,sha256=QQKDC7nUkNecC2knnnoLijhc2LvvjV8wZm3fcmRjftc,6122
61
+ c2cgeoportal_admin/views/roles.py,sha256=I6di90WR20EkFoy33milrHZ74_dgCkEVeNDM8E4P46w,6387
62
+ c2cgeoportal_admin/views/themes.py,sha256=6le9_3vhYa_ez0q52i--M24xPsycrGtpVKoCRhn7H0k,6267
63
+ c2cgeoportal_admin/views/themes_ordering.py,sha256=PgPaqKe7A5d2cYcDeJyoK615BNXayOmRcKNAAopvfRc,5689
64
+ c2cgeoportal_admin/views/treeitems.py,sha256=EgDArC5M39iihbB1Ok2VXmAAuH2DhhBrjeF0TbJgOQ4,4038
65
+ c2cgeoportal_admin/views/users.py,sha256=8zoSgSn0RFnu-Gc6gJr58T5ySsd0L2UQFZdSwfptdY8,6147
66
+ tests/__init__.py,sha256=weLUoRCG6zIlhW7Rfr7QEA0Ju-gYLfBekRcTCb5lTZ4,9785
67
+ tests/conftest.py,sha256=vowo5nwQ3DLSfost3ndihoYJFuhuhpoK__-B_ffsSLY,2646
67
68
  tests/test_edit_url.py,sha256=Mo_Vo5xvdpPasfjvhQUif5F3nKVpJ6GQJ_x_Hj5VNY8,4494
68
69
  tests/test_functionalities.py,sha256=tGQbEsQWjr_oExI3vWhLIioxylDaoUaOfEas42YPw50,5191
69
70
  tests/test_home.py,sha256=oWsKaWqRicNpUdaca54YvLIBRaGYnsXlv_Tjqv7guEQ,425
70
71
  tests/test_interface.py,sha256=z1jpRzW0R2e9BJWWurE-j-YkG5yhorn7h1XRIauUQ7A,5669
71
72
  tests/test_layer_groups.py,sha256=bisbaDY0SiyBc0rexYajbcvfdDt8Kux6VqXIEBLSULM,12191
72
- tests/test_layers_vectortiles.py,sha256=PpnR8wJyRcsByPTOrrtltQUYzzQ0qRzQM2no1z1rLgU,10404
73
+ tests/test_layers_cog.py,sha256=5p7NHZw1IXfHg8Weqie3ibjDIJYVm7KAGGOiaZoBYO0,9848
74
+ tests/test_layers_vectortiles.py,sha256=uZGO-0-uVuvkPVMQI11tSY381tEmgWeYvlxKI19pslg,10158
73
75
  tests/test_layers_wms.py,sha256=ynqO1cnXk2ZbSXR3l9hp0IyG8PMXbmR4eyubnwRvRfU,19494
74
76
  tests/test_layers_wmts.py,sha256=7zye_pZ_e0RyJdoT8oeHKPoYJMKWfTg0K8lEgMIu77Q,12181
75
77
  tests/test_layertree.py,sha256=Dxe10OwuilQ-AEgVIDU4Ns9U6PQ4kPWTxwItdBE7nSg,11335
76
78
  tests/test_learn.py,sha256=gQwe-Bim0eihZH0rbBWDn6_rIBxvQD_lyu9MlOljupM,2307
77
79
  tests/test_left_menu.py,sha256=xnlv5sD0k3wpCChKCnbpYRN0TA895pg8k6wVvjf99-4,919
78
- tests/test_lingua_extractor_config.py,sha256=vAfunJ4tVuqTJg4xinPwlB0EvA4sYhjY_iDBfMq8EW4,2495
79
- tests/test_logs.py,sha256=sUBC61rCSIfg9HBavhT6c0QPmPYUnEfDm91bUaUF4Q8,3147
80
+ tests/test_lingva_extractor_config.py,sha256=ZQE8zBl91khK68MX0chL6mQPgfpIWQgMxlqFFpCwmSw,2495
81
+ tests/test_logs.py,sha256=pxzHyOElW-x2-M3yoMEsHIZ3nrm5EptDAAAGfziEfv4,3132
80
82
  tests/test_main.py,sha256=_gUdMrMMAEzvGIf1QwkoHQkd0eBACz05ycTidCHP5Ao,365
81
83
  tests/test_metadatas.py,sha256=bVNxvZRKNRMmjQGr7Al1d4H85EjEaoesRpxytyld4Fw,12088
82
- tests/test_oauth2_clients.py,sha256=-aowsa2Dw77lxzuBb9ULW4iEJSB9yut-eYGP7YptT0M,7000
84
+ tests/test_oauth2_clients.py,sha256=5vyuCsba2WVgr6yMJysw73pAnXCZXhLO7dLIgV-spic,7028
83
85
  tests/test_ogc_servers.py,sha256=DGSMVIzYnw3bJT53VFGuPYIPMPCyHJDb5ZPJj1VM3Bo,8204
84
86
  tests/test_restriction_areas.py,sha256=5VhO9ZvtFQPy1kVFm96Mh_vf1LCI5oeIdl0dfvS6JD8,9003
85
- tests/test_role.py,sha256=eD7dXwP7RjCg14T9ncTfJuMUU4caY9yW3l5ka-gtCd4,12776
87
+ tests/test_role.py,sha256=2mbi0RwTESnIZIuUTxMi275ONOcPNKWN-ni7b00SO90,12804
86
88
  tests/test_themes.py,sha256=uhzHe2TbuNoLnL4VdYATPnOqtnZWWPKsvUTq6GUxwiU,16207
87
89
  tests/test_themes_ordering.py,sha256=T4Esr0C3EN5UdeEyYLa4ePvEn-bx3RNPkGBK3lDFoBo,2243
88
90
  tests/test_treegroup.py,sha256=Plv119G4TWlurWLE7Z1mWGeHHPScK_fWKcDmDzMUlIU,576
89
- tests/test_user.py,sha256=xD0yoJa_babVK69hHQzDkTs6wRWBMXFGD8k0-DfOd-4,12814
91
+ tests/test_user.py,sha256=5C9nrQVk4Bf0Z9BKd0uf_J8EtJLTOFSpzrNHXfg3NzI,13095
90
92
  tests/themes_ordering.py,sha256=UdydcRIzWC6RRnTMfl2JM_250DHuAhGC7rijHqfy7lk,1342
91
- c2cgeoportal_admin-2.8.1.181.dist-info/METADATA,sha256=o4YRNzkOkIbRkqH7mpsDwnZ5skJY0J0RTMpy6yhSRtM,1597
92
- c2cgeoportal_admin-2.8.1.181.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
93
- c2cgeoportal_admin-2.8.1.181.dist-info/entry_points.txt,sha256=kz-7AnYsbtK04jTpGUtcOeu2NbQiXW3CQV3AjyC32tw,165
94
- c2cgeoportal_admin-2.8.1.181.dist-info/top_level.txt,sha256=DgcTJgTvpJUB8HqwYB14PdLBPAOAFk0B8oqnSTFoAU4,25
95
- c2cgeoportal_admin-2.8.1.181.dist-info/RECORD,,
93
+ c2cgeoportal_admin-2.9rc2.dist-info/METADATA,sha256=eRPDi_v_H3ZI1AVK6Y3d5E3Bp2_J07Y4M3BfY2E9fbA,1381
94
+ c2cgeoportal_admin-2.9rc2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
95
+ c2cgeoportal_admin-2.9rc2.dist-info/entry_points.txt,sha256=iRK5w2E-PVbqHx48OuxznFEXTpoOdJyx6kjpaca0Fxc,164
96
+ c2cgeoportal_admin-2.9rc2.dist-info/top_level.txt,sha256=DgcTJgTvpJUB8HqwYB14PdLBPAOAFk0B8oqnSTFoAU4,25
97
+ c2cgeoportal_admin-2.9rc2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.40.0)
2
+ Generator: bdist_wheel (0.42.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -0,0 +1,5 @@
1
+ [lingva.extractors]
2
+ geomapfish-admin-config = c2cgeoportal_admin.lib.lingva_extractor:GeomapfishConfigExtractor
3
+
4
+ [paste.app_factory]
5
+ main = c2cgeoportal_admin:main
tests/__init__.py CHANGED
@@ -9,13 +9,15 @@ skip_if_ci = pytest.mark.skipif(os.environ.get("CI", "false") == "true", reason=
9
9
 
10
10
 
11
11
  def get_test_default_layers(dbsession, default_ogc_server):
12
- from c2cgeoportal_commons.models.main import LayerVectorTiles, LayerWMS, LayerWMTS
13
-
14
- default_wms = LayerWMS("wms-defaults")
15
- default_wms.ogc_server = default_ogc_server
16
- default_wms.time_widget = "datepicker"
17
- default_wms.time_mode = "value"
18
- dbsession.add(default_wms)
12
+ from c2cgeoportal_commons.models.main import LayerCOG, LayerVectorTiles, LayerWMS, LayerWMTS
13
+
14
+ default_wms = None
15
+ if default_ogc_server:
16
+ default_wms = LayerWMS("wms-defaults")
17
+ default_wms.ogc_server = default_ogc_server
18
+ default_wms.time_widget = "datepicker"
19
+ default_wms.time_mode = "value"
20
+ dbsession.add(default_wms)
19
21
  default_wmts = LayerWMTS("wmts-defaults")
20
22
  default_wmts.url = "https:///wmts.geo.admin_default.ch.org?service=wms&request=GetCapabilities"
21
23
  default_wmts.layer = "default"
@@ -24,8 +26,11 @@ def get_test_default_layers(dbsession, default_ogc_server):
24
26
  default_vectortiles = LayerVectorTiles("vectortiles-defaults")
25
27
  default_vectortiles.style = "https://vectortiles-staging.geoportail.lu/styles/roadmap/style.json"
26
28
  dbsession.add(default_vectortiles)
29
+ default_cog = LayerCOG("cog-defaults")
30
+ default_cog.url = "https://example.com/image.tiff"
31
+ dbsession.add(default_cog)
27
32
  dbsession.flush()
28
- return {"wms": default_wms, "wmts": default_wmts, "vectortiles": default_vectortiles}
33
+ return {"wms": default_wms, "wmts": default_wmts, "vectortiles": default_vectortiles, "cog": default_cog}
29
34
 
30
35
 
31
36
  def factory_build_layers(layer_builder, dbsession, add_dimension=True):
tests/conftest.py CHANGED
@@ -1,8 +1,15 @@
1
+ from typing import Any
2
+
3
+ import pyramid.request
1
4
  import pytest
5
+ import sqlalchemy.exc
2
6
  import transaction
3
7
  from pyramid import testing
4
8
  from pyramid.paster import bootstrap
9
+ from pyramid.router import Router
10
+ from pyramid.scripting import AppEnvironment
5
11
  from sqlalchemy.exc import DBAPIError
12
+ from sqlalchemy.orm import Session, SessionTransaction
6
13
  from webtest import TestApp as WebTestApp # Avoid warning with pytest
7
14
 
8
15
  from c2cgeoportal_commons.testing import generate_mappers, get_engine, get_session_factory, get_tm_session
@@ -11,31 +18,34 @@ from c2cgeoportal_commons.testing.initializedb import truncate_tables
11
18
 
12
19
  @pytest.fixture(scope="session")
13
20
  @pytest.mark.usefixtures("settings")
14
- def dbsession(settings):
21
+ def dbsession(settings: dict[str, Any]) -> Session:
15
22
  generate_mappers()
16
23
  engine = get_engine(settings)
17
- truncate_tables(engine)
18
24
  session_factory = get_session_factory(engine)
19
25
  session = get_tm_session(session_factory, transaction.manager)
26
+ truncate_tables(session)
20
27
  yield session
21
28
 
22
29
 
23
30
  @pytest.fixture(scope="function")
24
31
  @pytest.mark.usefixtures("dbsession")
25
- def transact(dbsession):
32
+ def transact(dbsession: Session) -> SessionTransaction:
26
33
  t = dbsession.begin_nested()
27
34
  yield t
28
- t.rollback()
35
+ try:
36
+ t.rollback()
37
+ except sqlalchemy.exc.ResourceClosedError:
38
+ print("The transaction was already closed")
29
39
  dbsession.expire_all()
30
40
 
31
41
 
32
- def raise_db_error(_):
42
+ def raise_db_error(_: Any) -> None:
33
43
  raise DBAPIError("this is a test !", None, None)
34
44
 
35
45
 
36
46
  @pytest.fixture(scope="function")
37
47
  @pytest.mark.usefixtures("dbsession")
38
- def raise_db_error_on_query(dbsession):
48
+ def raise_db_error_on_query(dbsession: Session) -> None:
39
49
  query = dbsession.query
40
50
  dbsession.query = raise_db_error
41
51
  yield
@@ -43,7 +53,7 @@ def raise_db_error_on_query(dbsession):
43
53
 
44
54
 
45
55
  @pytest.fixture(scope="session")
46
- def app_env():
56
+ def app_env() -> AppEnvironment:
47
57
  file_name = "/opt/c2cgeoportal/admin/tests/tests.ini"
48
58
  with bootstrap(file_name) as env:
49
59
  yield env
@@ -51,7 +61,7 @@ def app_env():
51
61
 
52
62
  @pytest.fixture(scope="session")
53
63
  @pytest.mark.usefixtures("app_env", "dbsession")
54
- def app(app_env, dbsession):
64
+ def app(app_env: AppEnvironment, dbsession: Session) -> Router:
55
65
  config = testing.setUp(registry=app_env["registry"])
56
66
  config.add_request_method(lambda request: dbsession, "dbsession", reify=True)
57
67
  config.add_route("user_add", "user_add")
@@ -64,12 +74,12 @@ def app(app_env, dbsession):
64
74
 
65
75
  @pytest.fixture(scope="session")
66
76
  @pytest.mark.usefixtures("app_env")
67
- def settings(app_env):
77
+ def settings(app_env: AppEnvironment) -> Any:
68
78
  yield app_env.get("registry").settings
69
79
 
70
80
 
71
81
  @pytest.fixture(scope="session") # noqa: ignore=F811
72
82
  @pytest.mark.usefixtures("app")
73
- def test_app(request, app):
83
+ def test_app(request: pyramid.request.Request, app: Router) -> WebTestApp:
74
84
  testapp = WebTestApp(app)
75
85
  yield testapp