c2cgeoportal-geoportal 2.9rc11__py3-none-any.whl → 2.9rc14__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.
- c2cgeoportal_geoportal/__init__.py +1 -0
- c2cgeoportal_geoportal/lib/common_headers.py +6 -1
- c2cgeoportal_geoportal/views/theme.py +19 -19
- {c2cgeoportal_geoportal-2.9rc11.dist-info → c2cgeoportal_geoportal-2.9rc14.dist-info}/METADATA +1 -1
- {c2cgeoportal_geoportal-2.9rc11.dist-info → c2cgeoportal_geoportal-2.9rc14.dist-info}/RECORD +9 -9
- tests/test_caching.py +14 -14
- {c2cgeoportal_geoportal-2.9rc11.dist-info → c2cgeoportal_geoportal-2.9rc14.dist-info}/WHEEL +0 -0
- {c2cgeoportal_geoportal-2.9rc11.dist-info → c2cgeoportal_geoportal-2.9rc14.dist-info}/entry_points.txt +0 -0
- {c2cgeoportal_geoportal-2.9rc11.dist-info → c2cgeoportal_geoportal-2.9rc14.dist-info}/top_level.txt +0 -0
@@ -738,6 +738,7 @@ def includeme(config: pyramid.config.Configurator) -> None:
|
|
738
738
|
c2cgeoportal_geoportal.views.add_redirect(config, "apihelp_redirect", "/apihelp.html", "apihelp.html")
|
739
739
|
|
740
740
|
config.add_route("themes", "/themes", request_method="GET", pregenerator=C2CPregenerator(role=True))
|
741
|
+
add_cors_route(config, "/themes", "themes")
|
741
742
|
|
742
743
|
config.add_route("invalidate", "/invalidate", request_method="GET")
|
743
744
|
|
@@ -63,7 +63,12 @@ def _set_cors_headers(
|
|
63
63
|
credentials: bool,
|
64
64
|
) -> None:
|
65
65
|
"""Handle CORS requests, as specified in https://www.w3.org/TR/cors/."""
|
66
|
-
response.vary = (
|
66
|
+
response.vary = (
|
67
|
+
*(response.vary or ()),
|
68
|
+
"Origin",
|
69
|
+
"Access-Control-Request-Headers",
|
70
|
+
*(("Access-Control-Request-Method",) if request.method == "OPTIONS" else ()),
|
71
|
+
)
|
67
72
|
|
68
73
|
if "Origin" not in request.headers:
|
69
74
|
return # Not a CORS request if this header is missing
|
@@ -985,18 +985,18 @@ class Theme:
|
|
985
985
|
assert models.DBSession is not None
|
986
986
|
tasks = set()
|
987
987
|
|
988
|
-
for ogc_server in
|
988
|
+
for ogc_server, nb_layers in (
|
989
|
+
models.DBSession.query(
|
990
|
+
main.OGCServer, sqlalchemy.func.count(main.LayerWMS.id) # pylint: disable=not-callable
|
991
|
+
)
|
992
|
+
.filter(main.LayerWMS.ogc_server_id == main.OGCServer.id)
|
993
|
+
.group_by(main.OGCServer.id)
|
994
|
+
.all()
|
995
|
+
):
|
989
996
|
# Don't load unused OGC servers, required for landing page, because the related OGC server
|
990
997
|
# will be on error in those functions.
|
991
|
-
nb_layers
|
992
|
-
|
993
|
-
sqlalchemy.func.count(main.LayerWMS.id) # pylint: disable=not-callable
|
994
|
-
)
|
995
|
-
.filter(main.LayerWMS.ogc_server_id == ogc_server.id)
|
996
|
-
.one()
|
997
|
-
)
|
998
|
-
_LOG.debug("%i layers for OGC server '%s'", nb_layers[0], ogc_server.name)
|
999
|
-
if nb_layers[0] > 0:
|
998
|
+
_LOG.debug("%i layers for OGC server '%s'", nb_layers, ogc_server.name)
|
999
|
+
if nb_layers > 0:
|
1000
1000
|
_LOG.debug("Preload OGC server '%s'", ogc_server.name)
|
1001
1001
|
url_internal_wfs, _, _ = self.get_url_internal_wfs(ogc_server, errors)
|
1002
1002
|
if url_internal_wfs is not None:
|
@@ -1143,15 +1143,15 @@ class Theme:
|
|
1143
1143
|
_LOG.info("Do preload in %.3fs.", time.time() - start_time)
|
1144
1144
|
_LOG.debug("Run garbage collection: %s", ", ".join([str(gc.collect(n)) for n in range(3)]))
|
1145
1145
|
result["ogcServers"] = {}
|
1146
|
-
for ogc_server in
|
1147
|
-
|
1148
|
-
|
1149
|
-
sqlalchemy.func.count(main.LayerWMS.id) # pylint: disable=not-callable
|
1150
|
-
)
|
1151
|
-
.filter(main.LayerWMS.ogc_server_id == ogc_server.id)
|
1152
|
-
.one()
|
1146
|
+
for ogc_server, nb_layers in (
|
1147
|
+
models.DBSession.query(
|
1148
|
+
main.OGCServer, sqlalchemy.func.count(main.LayerWMS.id) # pylint: disable=not-callable
|
1153
1149
|
)
|
1154
|
-
|
1150
|
+
.filter(main.LayerWMS.ogc_server_id == main.OGCServer.id)
|
1151
|
+
.group_by(main.OGCServer.id)
|
1152
|
+
.all()
|
1153
|
+
):
|
1154
|
+
if nb_layers == 0:
|
1155
1155
|
# QGIS Server landing page requires an OGC server that can't be used here.
|
1156
1156
|
continue
|
1157
1157
|
|
@@ -1190,7 +1190,7 @@ class Theme:
|
|
1190
1190
|
if name in attributes:
|
1191
1191
|
del attributes[name]
|
1192
1192
|
|
1193
|
-
result["ogcServers"][ogc_server.name] = {
|
1193
|
+
result["ogcServers"][ogc_server.name] = {
|
1194
1194
|
"url": url.url() if url else None,
|
1195
1195
|
"urlWfs": url_wfs.url() if url_wfs else None,
|
1196
1196
|
"type": ogc_server.type,
|
{c2cgeoportal_geoportal-2.9rc11.dist-info → c2cgeoportal_geoportal-2.9rc14.dist-info}/RECORD
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
c2cgeoportal_geoportal/__init__.py,sha256=
|
1
|
+
c2cgeoportal_geoportal/__init__.py,sha256=vP3TAy-iFzxLhpfc8IPJICbKaKOLB6wn0u6YiXJk_yQ,39263
|
2
2
|
c2cgeoportal_geoportal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
c2cgeoportal_geoportal/resources.py,sha256=n42Gns8DKw32GstDoUdNgud6xdAidaRwgAuNHqGH-c4,2158
|
4
4
|
c2cgeoportal_geoportal/lib/__init__.py,sha256=_67fO_aXQZRnxPXcShHBcs38mdYU5ch0FNX89RwMTgA,10431
|
@@ -8,7 +8,7 @@ c2cgeoportal_geoportal/lib/cacheversion.py,sha256=8ETNA02fh7AX39pNAkDrEJsCmPXVzY
|
|
8
8
|
c2cgeoportal_geoportal/lib/caching.py,sha256=BZzIjgEUfv7puP8XvWY6PAni7HybcLMZrGam3D3mCyA,7124
|
9
9
|
c2cgeoportal_geoportal/lib/check_collector.py,sha256=98N43jvjzCOh19Agipf8varCD9S9I9V8XYQcrSujv0k,3396
|
10
10
|
c2cgeoportal_geoportal/lib/checker.py,sha256=QLe0SUzfSwKYQFpGgFecWkJJlVjA1O2phwf-FvQQOUc,12547
|
11
|
-
c2cgeoportal_geoportal/lib/common_headers.py,sha256=
|
11
|
+
c2cgeoportal_geoportal/lib/common_headers.py,sha256=iVm54HUQT81KqXEa3mkzywFbjoAwAG-_oNIkJQjPPHA,6622
|
12
12
|
c2cgeoportal_geoportal/lib/dbreflection.py,sha256=viQotACmEAoLtJYHhQqAtcT3UQUvNVz9P_MlRCKgR9g,9759
|
13
13
|
c2cgeoportal_geoportal/lib/filter_capabilities.py,sha256=nah7A3A_m87M5lSXcw3HRaEnHMCLnXcwTQ3PdoGN4js,14343
|
14
14
|
c2cgeoportal_geoportal/lib/fulltextsearch.py,sha256=DrqO51QbDp56VpZa__2-8vp8U39izvLpyGhRCLTCaYc,2265
|
@@ -169,12 +169,12 @@ c2cgeoportal_geoportal/views/proxy.py,sha256=BCjFtnsrIQ2U30wk08YFLyt3Cq0yX3Rtwv5
|
|
169
169
|
c2cgeoportal_geoportal/views/raster.py,sha256=94rMGBQ7zHTvlKewBl-18LdoYRdLjW4880XlODDvhsE,7535
|
170
170
|
c2cgeoportal_geoportal/views/resourceproxy.py,sha256=S8PEqBpeJKsoLJlzA5lsqQoVDvh8pu5FEPh4OhJQU0Y,3183
|
171
171
|
c2cgeoportal_geoportal/views/shortener.py,sha256=54HNEDpueIdsKIpbWuk1MDpFC2gyo01MoAXc0uMVcl8,6167
|
172
|
-
c2cgeoportal_geoportal/views/theme.py,sha256=
|
172
|
+
c2cgeoportal_geoportal/views/theme.py,sha256=aX2v3p9R9be7u4YL_avHQ7ixQKO7FRMDinxiNzY4MSA,55884
|
173
173
|
c2cgeoportal_geoportal/views/tinyowsproxy.py,sha256=ydq3mKFd_KeQ0DG5ct59BlcIY8_2rsMAtGrAFE0407g,7916
|
174
174
|
c2cgeoportal_geoportal/views/vector_tiles.py,sha256=t_pZ4l6JpispZFr42EodcDIwAwG2q-MX12yI03w7Y6I,3569
|
175
175
|
tests/__init__.py,sha256=KxmbgvRWDSJoEDH1cXnDIjbfBsgCzs2KdkTPuzYMq84,3826
|
176
176
|
tests/test_cachebuster.py,sha256=asI1X_qI0MGklYuKuWyqvCPVbvhQcUe4fX91Dk-hUsE,2923
|
177
|
-
tests/test_caching.py,sha256=
|
177
|
+
tests/test_caching.py,sha256=pqY7j9UyWei4MwP3IuXgrtivoEg1vxC_ORFrl_HRFPM,13126
|
178
178
|
tests/test_checker.py,sha256=NaU6Ejg9XbwS2cwqXCtz5mJPRdBIPZb3d1MkXVufr0k,3638
|
179
179
|
tests/test_decimaljson.py,sha256=CQrkqWs66kmq1iYur5kjzKhvdhw9b4TMcKEsuVayxA4,2223
|
180
180
|
tests/test_headerstween.py,sha256=3PkfTbsUq2C7fEsckO_4aYu9-XGBSeOgf86ENSqx76o,2524
|
@@ -185,8 +185,8 @@ tests/test_mapserverproxy_route_predicate.py,sha256=SzILSSzIuilzIkUYVPZiVzLwW1du
|
|
185
185
|
tests/test_raster.py,sha256=82NJ2MXgZlMqs0ytN-VgNw376iURdk4PkAg__dyh5ns,11948
|
186
186
|
tests/test_wmstparsing.py,sha256=xjA8nJuXFl3H5Bfs4sJw_8qX8E8qvAALK7Hs2-DTP2A,9054
|
187
187
|
tests/xmlstr.py,sha256=rkTKSU4FGjupBKLx75H8o-goB0KbQrxDvdpc6xVX_uQ,5985
|
188
|
-
c2cgeoportal_geoportal-2.
|
189
|
-
c2cgeoportal_geoportal-2.
|
190
|
-
c2cgeoportal_geoportal-2.
|
191
|
-
c2cgeoportal_geoportal-2.
|
192
|
-
c2cgeoportal_geoportal-2.
|
188
|
+
c2cgeoportal_geoportal-2.9rc14.dist-info/METADATA,sha256=N0gNOJgnMq9vKahtWBVyNg4o9Tl56IVUbK2p_563Eow,1886
|
189
|
+
c2cgeoportal_geoportal-2.9rc14.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
190
|
+
c2cgeoportal_geoportal-2.9rc14.dist-info/entry_points.txt,sha256=3dnX260FsLX_AubeNMdyeta_z1X4CxcD3steAlfPx2I,1414
|
191
|
+
c2cgeoportal_geoportal-2.9rc14.dist-info/top_level.txt,sha256=PJIbY7Nx51dDrJ052f5mDA7c6Tehm5aD-Gb32L_CtJA,29
|
192
|
+
c2cgeoportal_geoportal-2.9rc14.dist-info/RECORD,,
|
tests/test_caching.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2015-
|
1
|
+
# Copyright (c) 2015-2024, Camptocamp SA
|
2
2
|
# All rights reserved.
|
3
3
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
@@ -64,7 +64,7 @@ class TestSetCorsHeaders(TestCase):
|
|
64
64
|
"Cache-Control": "max-age=10, public",
|
65
65
|
"Content-Length": "0",
|
66
66
|
"Content-Type": "text/html; charset=UTF-8",
|
67
|
-
"Vary": "Origin, Cookie",
|
67
|
+
"Vary": "Origin, Access-Control-Request-Headers, Cookie",
|
68
68
|
}
|
69
69
|
|
70
70
|
# 2. If the value of the Origin header is not a case-sensitive match for
|
@@ -74,7 +74,7 @@ class TestSetCorsHeaders(TestCase):
|
|
74
74
|
"Cache-Control": "max-age=10, public",
|
75
75
|
"Content-Length": "0",
|
76
76
|
"Content-Type": "text/html; charset=UTF-8",
|
77
|
-
"Vary": "Origin, Cookie",
|
77
|
+
"Vary": "Origin, Access-Control-Request-Headers, Cookie",
|
78
78
|
}
|
79
79
|
|
80
80
|
# 3. If the resource supports credentials add a single
|
@@ -85,7 +85,7 @@ class TestSetCorsHeaders(TestCase):
|
|
85
85
|
"Cache-Control": "max-age=10, public",
|
86
86
|
"Content-Length": "0",
|
87
87
|
"Content-Type": "text/html; charset=UTF-8",
|
88
|
-
"Vary": "Origin, Cookie",
|
88
|
+
"Vary": "Origin, Access-Control-Request-Headers, Cookie",
|
89
89
|
"Access-Control-Max-Age": self.MAX_AGE,
|
90
90
|
"Access-Control-Allow-Origin": self.ORIGIN2,
|
91
91
|
"Access-Control-Allow-Methods": CORS_METHODS,
|
@@ -110,7 +110,7 @@ class TestSetCorsHeaders(TestCase):
|
|
110
110
|
assert self._do("OPTIONS", {"Access-Control-Request-Method": "GET"}) == {
|
111
111
|
"Content-Length": "0",
|
112
112
|
"Content-Type": "text/html; charset=UTF-8",
|
113
|
-
"Vary": "Origin",
|
113
|
+
"Vary": "Origin, Access-Control-Request-Headers, Access-Control-Request-Method",
|
114
114
|
}
|
115
115
|
|
116
116
|
# 2. If the value of the Origin header is not a case-sensitive match for
|
@@ -119,7 +119,7 @@ class TestSetCorsHeaders(TestCase):
|
|
119
119
|
assert self._do("OPTIONS", {"Origin": "http://foe.com", "Access-Control-Request-Method": "GET"}) == {
|
120
120
|
"Content-Length": "0",
|
121
121
|
"Content-Type": "text/html; charset=UTF-8",
|
122
|
-
"Vary": "Origin",
|
122
|
+
"Vary": "Origin, Access-Control-Request-Headers, Access-Control-Request-Method",
|
123
123
|
}
|
124
124
|
|
125
125
|
# 3. If there is no Access-Control-Request-Method header or if parsing
|
@@ -128,7 +128,7 @@ class TestSetCorsHeaders(TestCase):
|
|
128
128
|
assert self._do("OPTIONS", {"Origin": self.ORIGIN1}) == {
|
129
129
|
"Content-Length": "0",
|
130
130
|
"Content-Type": "text/html; charset=UTF-8",
|
131
|
-
"Vary": "Origin",
|
131
|
+
"Vary": "Origin, Access-Control-Request-Headers, Access-Control-Request-Method",
|
132
132
|
}
|
133
133
|
|
134
134
|
# 4. If there are no Access-Control-Request-Headers headers let header
|
@@ -136,7 +136,7 @@ class TestSetCorsHeaders(TestCase):
|
|
136
136
|
assert self._do("OPTIONS", {"Origin": self.ORIGIN1, "Access-Control-Request-Method": "GET"}) == {
|
137
137
|
"Content-Length": "0",
|
138
138
|
"Content-Type": "text/html; charset=UTF-8",
|
139
|
-
"Vary": "Origin",
|
139
|
+
"Vary": "Origin, Access-Control-Request-Headers, Access-Control-Request-Method",
|
140
140
|
"Access-Control-Allow-Origin": self.ORIGIN1,
|
141
141
|
"Access-Control-Max-Age": self.MAX_AGE,
|
142
142
|
"Access-Control-Allow-Methods": CORS_METHODS,
|
@@ -162,7 +162,7 @@ class TestSetCorsHeaders(TestCase):
|
|
162
162
|
) == {
|
163
163
|
"Content-Length": "0",
|
164
164
|
"Content-Type": "text/html; charset=UTF-8",
|
165
|
-
"Vary": "Origin",
|
165
|
+
"Vary": "Origin, Access-Control-Request-Headers, Access-Control-Request-Method",
|
166
166
|
"Access-Control-Allow-Origin": self.ORIGIN1,
|
167
167
|
"Access-Control-Allow-Credentials": "true",
|
168
168
|
"Access-Control-Max-Age": self.MAX_AGE,
|
@@ -191,7 +191,7 @@ class TestSetCorsHeaders(TestCase):
|
|
191
191
|
) == {
|
192
192
|
"Content-Length": "0",
|
193
193
|
"Content-Type": "text/html; charset=UTF-8",
|
194
|
-
"Vary": "Origin",
|
194
|
+
"Vary": "Origin, Access-Control-Request-Headers, Access-Control-Request-Method",
|
195
195
|
"Access-Control-Allow-Origin": self.ORIGIN1,
|
196
196
|
"Access-Control-Max-Age": self.MAX_AGE,
|
197
197
|
"Access-Control-Allow-Methods": CORS_METHODS,
|
@@ -205,7 +205,7 @@ class TestSetCorsHeaders(TestCase):
|
|
205
205
|
"Cache-Control": "max-age=10, public",
|
206
206
|
"Content-Length": "0",
|
207
207
|
"Content-Type": "text/html; charset=UTF-8",
|
208
|
-
"Vary": "Origin, Cookie",
|
208
|
+
"Vary": "Origin, Access-Control-Request-Headers, Cookie",
|
209
209
|
}
|
210
210
|
|
211
211
|
def test_match_all(self):
|
@@ -220,7 +220,7 @@ class TestSetCorsHeaders(TestCase):
|
|
220
220
|
"Cache-Control": "max-age=10, public",
|
221
221
|
"Content-Length": "0",
|
222
222
|
"Content-Type": "text/html; charset=UTF-8",
|
223
|
-
"Vary": "Origin, Cookie",
|
223
|
+
"Vary": "Origin, Access-Control-Request-Headers, Cookie",
|
224
224
|
"Access-Control-Max-Age": self.MAX_AGE,
|
225
225
|
"Access-Control-Allow-Origin": self.ORIGIN1,
|
226
226
|
"Access-Control-Allow-Methods": CORS_METHODS,
|
@@ -233,7 +233,7 @@ class TestSetCorsHeaders(TestCase):
|
|
233
233
|
"Cache-Control": "max-age=10, public",
|
234
234
|
"Content-Length": "0",
|
235
235
|
"Content-Type": "text/html; charset=UTF-8",
|
236
|
-
"Vary": "Origin, Cookie",
|
236
|
+
"Vary": "Origin, Access-Control-Request-Headers, Cookie",
|
237
237
|
"Access-Control-Max-Age": self.MAX_AGE,
|
238
238
|
"Access-Control-Allow-Origin": "*",
|
239
239
|
"Access-Control-Allow-Methods": CORS_METHODS,
|
@@ -252,7 +252,7 @@ class TestSetCorsHeaders(TestCase):
|
|
252
252
|
) == {
|
253
253
|
"Content-Length": "0",
|
254
254
|
"Content-Type": "text/html; charset=UTF-8",
|
255
|
-
"Vary": "Origin",
|
255
|
+
"Vary": "Origin, Access-Control-Request-Headers, Access-Control-Request-Method",
|
256
256
|
"Access-Control-Allow-Origin": "*",
|
257
257
|
"Access-Control-Max-Age": self.MAX_AGE,
|
258
258
|
"Access-Control-Allow-Methods": CORS_METHODS,
|
File without changes
|
File without changes
|
{c2cgeoportal_geoportal-2.9rc11.dist-info → c2cgeoportal_geoportal-2.9rc14.dist-info}/top_level.txt
RENAMED
File without changes
|