c2cgeoportal-geoportal 2.9rc12__py3-none-any.whl → 2.9rc15__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.
@@ -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 = (response.vary or ()) + ("Origin",)
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: c2cgeoportal-geoportal
3
- Version: 2.9rc12
3
+ Version: 2.9rc15
4
4
  Summary: c2cgeoportal geoportal
5
5
  Home-page: https://github.com/camptocamp/c2cgeoportal/
6
6
  Author: Camptocamp
@@ -1,4 +1,4 @@
1
- c2cgeoportal_geoportal/__init__.py,sha256=Te7K9wopbz8ehFtjy_OW30BnTg5Sk_XD94Gws_1740M,39215
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=IYMMo1IT33o83h79_9yN2Ol6fqqIEHaXPTBzLkYX8go,6472
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
@@ -174,7 +174,7 @@ c2cgeoportal_geoportal/views/tinyowsproxy.py,sha256=ydq3mKFd_KeQ0DG5ct59BlcIY8_2
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=8exM2zAPPIoJLalFi8l3e1KA_l2WSwWGjTXDYN_tC9o,12493
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.9rc12.dist-info/METADATA,sha256=1Y-RRG51DQAoUHiJty2Ahmx84p_Co6uVJznARQZKPQA,1886
189
- c2cgeoportal_geoportal-2.9rc12.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
190
- c2cgeoportal_geoportal-2.9rc12.dist-info/entry_points.txt,sha256=3dnX260FsLX_AubeNMdyeta_z1X4CxcD3steAlfPx2I,1414
191
- c2cgeoportal_geoportal-2.9rc12.dist-info/top_level.txt,sha256=PJIbY7Nx51dDrJ052f5mDA7c6Tehm5aD-Gb32L_CtJA,29
192
- c2cgeoportal_geoportal-2.9rc12.dist-info/RECORD,,
188
+ c2cgeoportal_geoportal-2.9rc15.dist-info/METADATA,sha256=MnOtZZUTi8OT7szmn-381iEYPE9JbJvn5E0vMfv8uXc,1886
189
+ c2cgeoportal_geoportal-2.9rc15.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
190
+ c2cgeoportal_geoportal-2.9rc15.dist-info/entry_points.txt,sha256=3dnX260FsLX_AubeNMdyeta_z1X4CxcD3steAlfPx2I,1414
191
+ c2cgeoportal_geoportal-2.9rc15.dist-info/top_level.txt,sha256=PJIbY7Nx51dDrJ052f5mDA7c6Tehm5aD-Gb32L_CtJA,29
192
+ c2cgeoportal_geoportal-2.9rc15.dist-info/RECORD,,
tests/test_caching.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2015-2023, Camptocamp SA
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,