c2cgeoportal-geoportal 2.8.1.170__py2.py3-none-any.whl → 2.8.1.171__py2.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.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2012-2023, Camptocamp SA
1
+ # Copyright (c) 2012-2024, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -33,8 +33,6 @@ from typing import Any, Dict, List, Optional, cast
33
33
  import pyramid.request
34
34
  import pyramid.response
35
35
 
36
- from c2cgeoportal_geoportal.lib import is_intranet
37
-
38
36
  _LOG = logging.getLogger(__name__)
39
37
 
40
38
 
@@ -119,6 +117,8 @@ def _set_common_headers(
119
117
  ) -> pyramid.response.Response:
120
118
  """Set the common headers."""
121
119
 
120
+ del request # Unused
121
+
122
122
  response.headers.update(service_headers_settings.get("headers", {}))
123
123
 
124
124
  if cache in (Cache.PRIVATE, Cache.PRIVATE_NO):
@@ -136,10 +136,7 @@ def _set_common_headers(
136
136
  elif cache in (Cache.PUBLIC, Cache.PUBLIC_NO):
137
137
  response.cache_control.public = True
138
138
  elif cache in (Cache.PRIVATE, Cache.PRIVATE_NO):
139
- if hasattr(request, "user") and request.user is not None or is_intranet(request):
140
- response.cache_control.private = True
141
- else:
142
- response.cache_control.public = True
139
+ response.cache_control.private = True
143
140
  else:
144
141
  raise Exception("Invalid cache type") # pylint: disable=broad-exception-raised
145
142
 
@@ -22,6 +22,12 @@ Version 2.8.1
22
22
 
23
23
  End of support by GitHub: https://github.blog/changelog/2024-04-10-github-hosted-runner-images-deprecation-notice-docker-compose-v1/.
24
24
 
25
+ 4. Previously the `Cache-Control` header was set to `public` when we are not authenticated to an endpoint
26
+ that use the authentication. But this didn't works in every cases, for example when we use the intranet
27
+ role and when we have a reverse proxy with cache. Now it's always set to private for all the endpoints
28
+ that use the authentication.
29
+
30
+
25
31
  =============
26
32
  Version 2.8.0
27
33
  =============
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: c2cgeoportal-geoportal
3
- Version: 2.8.1.170
3
+ Version: 2.8.1.171
4
4
  Summary: c2cgeoportal geoportal
5
5
  Home-page: https://github.com/camptocamp/c2cgeoportal/
6
6
  Author: Camptocamp
@@ -8,7 +8,7 @@ c2cgeoportal_geoportal/lib/cacheversion.py,sha256=M_0Ci0HPQASkcHbnvG33G9SOsFdRMK
8
8
  c2cgeoportal_geoportal/lib/caching.py,sha256=3tcz5ZCsdL0ByINiNFux3--zoqQbJVuYalhTPYrIDvE,6713
9
9
  c2cgeoportal_geoportal/lib/check_collector.py,sha256=-x5iFUMw0NfPalG1RI6WoKTiW1BlUvHTiAJy_2mMu2s,3414
10
10
  c2cgeoportal_geoportal/lib/checker.py,sha256=RdcGWUjDHowaxl5OZGM5uNrG-K5v4P5BtnfANJO3lfY,12549
11
- c2cgeoportal_geoportal/lib/common_headers.py,sha256=xVHJw8ihumvUG2TcIPv11E2MevoAMDmz6-k3nC6nU-0,6500
11
+ c2cgeoportal_geoportal/lib/common_headers.py,sha256=sa3FqwE5_1G0heJu8ep9cZImoBqndITLA405IivY_Dc,6318
12
12
  c2cgeoportal_geoportal/lib/dbreflection.py,sha256=TL5xovttqEKkkjKTgOaS1IRtrUp4pY1H8l8XIjC8l_g,9638
13
13
  c2cgeoportal_geoportal/lib/filter_capabilities.py,sha256=JVx0nBWDdLMCfd0GwG7AdE4tb26DEuimkP87XEEQbXg,14434
14
14
  c2cgeoportal_geoportal/lib/fulltextsearch.py,sha256=6mUdf4EydFiI7gjx2vmcc4yyRRFs4cH3gg_XdBePAww,2271
@@ -135,7 +135,7 @@ c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/tests/test_app.
135
135
  c2cgeoportal_geoportal/scaffolds/create/{{cookiecutter.project}}/tilegeneration/config.yaml.tmpl,sha256=y-X8uAZP9mEq3k6NygBI_FynZeEQ_IatFPXkzWs5UAQ,6181
136
136
  c2cgeoportal_geoportal/scaffolds/update/cookiecutter.json,sha256=x3FFn3b67GPGCsjg36iGXCudjaTSfwGHcwHS6HHVpPQ,539
137
137
  c2cgeoportal_geoportal/scaffolds/update/{{cookiecutter.project}}/.upgrade.yaml,sha256=_ctFv4lgUP4_7LozPND8jKwixN5jeaiB0bGSrnH4jV4,2559
138
- c2cgeoportal_geoportal/scaffolds/update/{{cookiecutter.project}}/CONST_CHANGELOG.txt,sha256=q4_d9d5DnfTRNPp8smHkRQ-9IAhQFj5sbQtv8mLbgxo,8264
138
+ c2cgeoportal_geoportal/scaffolds/update/{{cookiecutter.project}}/CONST_CHANGELOG.txt,sha256=2vZ20rEGchwMzvvFMBsbY2glEZsYBItm9l5llbWMec4,8617
139
139
  c2cgeoportal_geoportal/scaffolds/update/{{cookiecutter.project}}/CONST_create_template/tests/test_testapp.py,sha256=Mxx4z7TnM3VHF8xxEorZjIw9uQRNGM7y5EHW7VYaEb8,1796
140
140
  c2cgeoportal_geoportal/scaffolds/update/{{cookiecutter.project}}/geoportal/CONST_config-schema.yaml,sha256=bjpHnvjPDNr-wVodb3NC9XkCcr-hnJo8JhirX2t38MU,21183
141
141
  c2cgeoportal_geoportal/scaffolds/update/{{cookiecutter.project}}/geoportal/CONST_vars.yaml,sha256=gQOPZqPUitn674cVrf-DonrRWZmZ7sLAE1NL9YXfBms,47538
@@ -173,7 +173,7 @@ c2cgeoportal_geoportal/views/tinyowsproxy.py,sha256=cfWyZc4mn003TF7XY03NC2S8svZo
173
173
  c2cgeoportal_geoportal/views/vector_tiles.py,sha256=jerhFjx3_qImXz0a3eQI4FLSSe0CGmkjSt6pAXzzxUg,3460
174
174
  tests/__init__.py,sha256=KxmbgvRWDSJoEDH1cXnDIjbfBsgCzs2KdkTPuzYMq84,3826
175
175
  tests/test_cachebuster.py,sha256=asI1X_qI0MGklYuKuWyqvCPVbvhQcUe4fX91Dk-hUsE,2923
176
- tests/test_caching.py,sha256=8exM2zAPPIoJLalFi8l3e1KA_l2WSwWGjTXDYN_tC9o,12493
176
+ tests/test_caching.py,sha256=8mHfSvQPEBq6sT6wvHC5Hk3mpJsyHBuOVMp4w0k37j8,12499
177
177
  tests/test_checker.py,sha256=NaU6Ejg9XbwS2cwqXCtz5mJPRdBIPZb3d1MkXVufr0k,3638
178
178
  tests/test_decimaljson.py,sha256=CQrkqWs66kmq1iYur5kjzKhvdhw9b4TMcKEsuVayxA4,2223
179
179
  tests/test_headerstween.py,sha256=3PkfTbsUq2C7fEsckO_4aYu9-XGBSeOgf86ENSqx76o,2524
@@ -184,8 +184,8 @@ tests/test_mapserverproxy_route_predicate.py,sha256=SzILSSzIuilzIkUYVPZiVzLwW1du
184
184
  tests/test_raster.py,sha256=82NJ2MXgZlMqs0ytN-VgNw376iURdk4PkAg__dyh5ns,11948
185
185
  tests/test_wmstparsing.py,sha256=xjA8nJuXFl3H5Bfs4sJw_8qX8E8qvAALK7Hs2-DTP2A,9054
186
186
  tests/xmlstr.py,sha256=rkTKSU4FGjupBKLx75H8o-goB0KbQrxDvdpc6xVX_uQ,5985
187
- c2cgeoportal_geoportal-2.8.1.170.dist-info/METADATA,sha256=3uk4QqqrMtEXTmFHZcE7o-OfqJ00a7IsrBAdvz2E5ro,2172
188
- c2cgeoportal_geoportal-2.8.1.170.dist-info/WHEEL,sha256=a-zpFRIJzOq5QfuhBzbhiA1eHTzNCJn8OdRvhdNX0Rk,110
189
- c2cgeoportal_geoportal-2.8.1.170.dist-info/entry_points.txt,sha256=w0xGr1Bo8q5GBFiP4JgqbSIg-bNhG7bsGoEaGSTfzaE,1415
190
- c2cgeoportal_geoportal-2.8.1.170.dist-info/top_level.txt,sha256=PJIbY7Nx51dDrJ052f5mDA7c6Tehm5aD-Gb32L_CtJA,29
191
- c2cgeoportal_geoportal-2.8.1.170.dist-info/RECORD,,
187
+ c2cgeoportal_geoportal-2.8.1.171.dist-info/METADATA,sha256=l-yF5Tq-K3OkvFMG9DlULp1bd2rybqr3qxCfbAOPWTc,2172
188
+ c2cgeoportal_geoportal-2.8.1.171.dist-info/WHEEL,sha256=a-zpFRIJzOq5QfuhBzbhiA1eHTzNCJn8OdRvhdNX0Rk,110
189
+ c2cgeoportal_geoportal-2.8.1.171.dist-info/entry_points.txt,sha256=w0xGr1Bo8q5GBFiP4JgqbSIg-bNhG7bsGoEaGSTfzaE,1415
190
+ c2cgeoportal_geoportal-2.8.1.171.dist-info/top_level.txt,sha256=PJIbY7Nx51dDrJ052f5mDA7c6Tehm5aD-Gb32L_CtJA,29
191
+ c2cgeoportal_geoportal-2.8.1.171.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
@@ -61,7 +61,7 @@ class TestSetCorsHeaders(TestCase):
61
61
  # 1. If the Origin header is not present terminate this set of steps.
62
62
  # The request is outside the scope of this specification.
63
63
  assert self._do("POST", {}) == {
64
- "Cache-Control": "max-age=10, public",
64
+ "Cache-Control": "max-age=10, private",
65
65
  "Content-Length": "0",
66
66
  "Content-Type": "text/html; charset=UTF-8",
67
67
  "Vary": "Origin, Cookie",
@@ -71,7 +71,7 @@ class TestSetCorsHeaders(TestCase):
71
71
  # any of the values in list of origins, do not set any additional
72
72
  # headers and terminate this set of steps.
73
73
  assert self._do("POST", {"Origin": "http://foe.com"}) == {
74
- "Cache-Control": "max-age=10, public",
74
+ "Cache-Control": "max-age=10, private",
75
75
  "Content-Length": "0",
76
76
  "Content-Type": "text/html; charset=UTF-8",
77
77
  "Vary": "Origin, Cookie",
@@ -82,7 +82,7 @@ class TestSetCorsHeaders(TestCase):
82
82
  # header as value, and add a single Access-Control-Allow-Credentials
83
83
  # header with the case-sensitive string "true" as value.
84
84
  assert self._do("POST", {"Origin": self.ORIGIN2}, credentials=True) == {
85
- "Cache-Control": "max-age=10, public",
85
+ "Cache-Control": "max-age=10, private",
86
86
  "Content-Length": "0",
87
87
  "Content-Type": "text/html; charset=UTF-8",
88
88
  "Vary": "Origin, Cookie",
@@ -202,7 +202,7 @@ class TestSetCorsHeaders(TestCase):
202
202
  def test_not_configured(self):
203
203
  # If the service is not configured, then no CORS head.
204
204
  assert self._do("GET", {"Origin": self.ORIGIN1}, settings=None) == {
205
- "Cache-Control": "max-age=10, public",
205
+ "Cache-Control": "max-age=10, private",
206
206
  "Content-Length": "0",
207
207
  "Content-Type": "text/html; charset=UTF-8",
208
208
  "Vary": "Origin, Cookie",
@@ -217,7 +217,7 @@ class TestSetCorsHeaders(TestCase):
217
217
  # An origin included in the access_control_allow_origin list is OK with
218
218
  # credentials
219
219
  assert self._do("POST", {"Origin": self.ORIGIN1}, credentials=True, settings=settings) == {
220
- "Cache-Control": "max-age=10, public",
220
+ "Cache-Control": "max-age=10, private",
221
221
  "Content-Length": "0",
222
222
  "Content-Type": "text/html; charset=UTF-8",
223
223
  "Vary": "Origin, Cookie",
@@ -230,7 +230,7 @@ class TestSetCorsHeaders(TestCase):
230
230
  # 3. Otherwise, add a single Access-Control-Allow-Origin header, with
231
231
  # either the value of the Origin header or the string "*" as value.
232
232
  assert self._do("POST", {"Origin": "http://www.guest.com"}, settings=settings) == {
233
- "Cache-Control": "max-age=10, public",
233
+ "Cache-Control": "max-age=10, private",
234
234
  "Content-Length": "0",
235
235
  "Content-Type": "text/html; charset=UTF-8",
236
236
  "Vary": "Origin, Cookie",