c2cgeoportal-geoportal 2.7.1.140__py2.py3-none-any.whl → 2.7.1.141__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) 2011-2021, Camptocamp SA
1
+ # Copyright (c) 2011-2024, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -142,11 +142,12 @@ def get_setting(settings: Any, path: Iterable[str], default: Any = None) -> Any:
142
142
 
143
143
 
144
144
  @CACHE_REGION_OBJ.cache_on_arguments() # type: ignore
145
- def get_ogc_server_wms_url_ids(request: pyramid.request.Request) -> Dict[str, List[int]]:
145
+ def get_ogc_server_wms_url_ids(request: pyramid.request.Request, host: str) -> Dict[str, List[int]]:
146
146
  """Get the OGCServer ids mapped on the WMS URL."""
147
147
  from c2cgeoportal_commons.models import DBSession # pylint: disable=import-outside-toplevel
148
148
  from c2cgeoportal_commons.models.main import OGCServer # pylint: disable=import-outside-toplevel
149
149
 
150
+ del host # used for cache
150
151
  errors: Set[str] = set()
151
152
  servers: Dict[str, List[int]] = {}
152
153
  for ogc_server in DBSession.query(OGCServer).all():
@@ -157,11 +158,12 @@ def get_ogc_server_wms_url_ids(request: pyramid.request.Request) -> Dict[str, Li
157
158
 
158
159
 
159
160
  @CACHE_REGION_OBJ.cache_on_arguments() # type: ignore
160
- def get_ogc_server_wfs_url_ids(request: pyramid.request.Request) -> Dict[str, List[int]]:
161
+ def get_ogc_server_wfs_url_ids(request: pyramid.request.Request, host: str) -> Dict[str, List[int]]:
161
162
  """Get the OGCServer ids mapped on the WFS URL."""
162
163
  from c2cgeoportal_commons.models import DBSession # pylint: disable=import-outside-toplevel
163
164
  from c2cgeoportal_commons.models.main import OGCServer # pylint: disable=import-outside-toplevel
164
165
 
166
+ del host # used for cache
165
167
  errors: Set[str] = set()
166
168
  servers: Dict[str, List[int]] = {}
167
169
  for ogc_server in DBSession.query(OGCServer).all():
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2014-2023, Camptocamp SA
1
+ # Copyright (c) 2014-2024, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -112,7 +112,9 @@ def filter_capabilities(
112
112
  wms_structure_ = wms_structure(url, headers.get("Host"), request)
113
113
 
114
114
  ogc_server_ids = (
115
- get_ogc_server_wms_url_ids(request) if wms else get_ogc_server_wfs_url_ids(request)
115
+ get_ogc_server_wms_url_ids(request, request.host)
116
+ if wms
117
+ else get_ogc_server_wfs_url_ids(request, request.host)
116
118
  ).get(url.url())
117
119
  gmf_private_layers = copy.copy(get_private_layers(ogc_server_ids))
118
120
  for id_ in list(get_protected_layers(request, ogc_server_ids).keys()):
@@ -150,7 +152,7 @@ def filter_wfst_capabilities(content: str, wfs_url: Url, request: pyramid.reques
150
152
  """Filter the WTS capabilities."""
151
153
 
152
154
  writable_layers: Set[str] = set()
153
- ogc_server_ids = get_ogc_server_wfs_url_ids(request).get(wfs_url.url())
155
+ ogc_server_ids = get_ogc_server_wfs_url_ids(request, request.host).get(wfs_url.url())
154
156
 
155
157
  for gmf_layer in list(get_writable_layers(request, ogc_server_ids).values()):
156
158
  writable_layers |= set(gmf_layer.layer.split(","))
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2011-2021, Camptocamp SA
1
+ # Copyright (c) 2011-2024, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2011-2021, Camptocamp SA
1
+ # Copyright (c) 2011-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 PrintProxy(Proxy):
64
64
  query_string = urllib.parse.urlencode(params)
65
65
 
66
66
  resp, content = self._capabilities(
67
- templates, query_string, self.request.method, self.request.referrer
67
+ templates, query_string, self.request.method, self.request.referrer, self.request.host
68
68
  )
69
69
 
70
70
  response = self._build_response(resp, content, Cache.PRIVATE, "print")
@@ -74,12 +74,14 @@ class PrintProxy(Proxy):
74
74
 
75
75
  @CACHE_REGION.cache_on_arguments() # type: ignore
76
76
  def _capabilities(
77
- self, templates: List[str], query_string: Dict[str, str], method: str, referrer: str
77
+ self, templates: List[str], query_string: Dict[str, str], method: str, referrer: str, host: str
78
78
  ) -> Tuple[requests.Response, str]:
79
79
  del query_string # Just for caching
80
80
  del method # Just for caching
81
81
  del referrer # Just for caching
82
- # get URL
82
+ del host # Just for caching
83
+
84
+ # Get URL
83
85
  _url = self.request.get_organization_print_url() + "/capabilities.json"
84
86
 
85
87
  response = self._proxy(Url(_url))
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
- # Copyright (c) 2011-2022, Camptocamp SA
3
+ # Copyright (c) 2011-2024, Camptocamp SA
4
4
  # All rights reserved.
5
5
 
6
6
  # Redistribution and use in source and binary forms, with or without
@@ -175,9 +175,10 @@ class Proxy:
175
175
  return response
176
176
 
177
177
  @CACHE_REGION.cache_on_arguments() # type: ignore
178
- def _proxy_cache(self, method: str, *args: Any, **kwargs: Any) -> pyramid.response.Response:
178
+ def _proxy_cache(self, host: str, method: str, *args: Any, **kwargs: Any) -> pyramid.response.Response:
179
179
  # Method is only for the cache
180
- del method
180
+ del host, method
181
+
181
182
  kwargs["cache"] = True
182
183
  return self._proxy(*args, **kwargs)
183
184
 
@@ -193,7 +194,7 @@ class Proxy:
193
194
  headers_update = {}
194
195
  cache = kwargs.get("cache", False)
195
196
  if cache is True:
196
- response = self._proxy_cache(url, self.request.method, **kwargs)
197
+ response = self._proxy_cache(url, self.request.host, self.request.method, **kwargs)
197
198
  else:
198
199
  response = self._proxy(url, **kwargs)
199
200
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: c2cgeoportal-geoportal
3
- Version: 2.7.1.140
3
+ Version: 2.7.1.141
4
4
  Summary: c2cgeoportal geoportal
5
5
  Home-page: https://github.com/camptocamp/c2cgeoportal/
6
6
  Author: Camptocamp
@@ -1,7 +1,7 @@
1
1
  c2cgeoportal_geoportal/__init__.py,sha256=9s5YOvb5qlaQf_TmonFKXMwx6a-pLAG2brbRrb4Kbuc,32401
2
2
  c2cgeoportal_geoportal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  c2cgeoportal_geoportal/resources.py,sha256=6CMHJveA-nDBNHBO0MudHCu2tn0AdKXmLKrTv8Ulz08,2182
4
- c2cgeoportal_geoportal/lib/__init__.py,sha256=jsDLoTJT5ZTZuXB7tuAgprayqzzORyC3dbGyqNQnbvE,10290
4
+ c2cgeoportal_geoportal/lib/__init__.py,sha256=d0Z_99AxtbdZAtSUT8iOpRg5_ZV0lnERmkamri5x6TM,10374
5
5
  c2cgeoportal_geoportal/lib/authentication.py,sha256=OlqVnfzNeSrA7cnCTk3hPkSNEWBBrTtwb2KifcsLSU4,8997
6
6
  c2cgeoportal_geoportal/lib/bashcolor.py,sha256=LQgOgtFUvgJ4Ed3-YW3RPjvhBMZBbXBBkUZKE4unRCI,1889
7
7
  c2cgeoportal_geoportal/lib/cacheversion.py,sha256=M_0Ci0HPQASkcHbnvG33G9SOsFdRMKSHUP5G5Yt1yvI,2948
@@ -10,7 +10,7 @@ c2cgeoportal_geoportal/lib/check_collector.py,sha256=-x5iFUMw0NfPalG1RI6WoKTiW1B
10
10
  c2cgeoportal_geoportal/lib/checker.py,sha256=ZdpACmoeeiNO16wM0oZc3bHkXgH8-0lYpWa7b_-937E,12323
11
11
  c2cgeoportal_geoportal/lib/common_headers.py,sha256=qwIWaNA_wMeJ2UrbtBFG0v3R26HgEn8npBRtSbjeyTE,6458
12
12
  c2cgeoportal_geoportal/lib/dbreflection.py,sha256=XWShaJrAE2vDAzAh-z2YfIVBrGiIzJ_WZEzd2Thne5I,9629
13
- c2cgeoportal_geoportal/lib/filter_capabilities.py,sha256=jsmP6yiIE6nuT2pbP32CudrSx0wgC-S_NVZcSfpKmUU,14172
13
+ c2cgeoportal_geoportal/lib/filter_capabilities.py,sha256=vEvQ2SyITKI_A7XshhHODy_N31URliwEWKoJkwOKnHA,14230
14
14
  c2cgeoportal_geoportal/lib/fulltextsearch.py,sha256=6mUdf4EydFiI7gjx2vmcc4yyRRFs4cH3gg_XdBePAww,2271
15
15
  c2cgeoportal_geoportal/lib/functionality.py,sha256=DqqLx3dwBY7QxpQgcDGh8NuxE1-sWVuSPk5k3bNE2bM,6293
16
16
  c2cgeoportal_geoportal/lib/headers.py,sha256=d6lelDs1fDh5xO8Dz34r-TRgSETY2bb1eEIDuk6FJHM,2622
@@ -152,13 +152,13 @@ c2cgeoportal_geoportal/views/geometry_processing.py,sha256=OlvpcDSrvqy-xykmycWh5
152
152
  c2cgeoportal_geoportal/views/i18n.py,sha256=7Avpt-aVEVlS3SrwtZkvuJ8_0gBZvVrCviyaIZBx7jY,5292
153
153
  c2cgeoportal_geoportal/views/layers.py,sha256=EqaICEToh5MOdp9h7gG60peuV6PBAyw6euqliA174LU,28850
154
154
  c2cgeoportal_geoportal/views/login.py,sha256=BugfdgTg4f73yo6e1uSshEYu0MZhwS9YaLo0c9JYPrM,19104
155
- c2cgeoportal_geoportal/views/mapserverproxy.py,sha256=Oyc9T_L9-yNYKrOszp28vLFgxzDTTwHGYVhLdCGWy70,8203
155
+ c2cgeoportal_geoportal/views/mapserverproxy.py,sha256=yl2O6FJZxJ1TVU7DvQpaTLT1JsNlqId9Sgiv44Umd4A,8203
156
156
  c2cgeoportal_geoportal/views/memory.py,sha256=nb2repOnil0PdziEjCLOZ-84LFKLkdAlKTnnMQoXDdA,3627
157
157
  c2cgeoportal_geoportal/views/ogcproxy.py,sha256=M9hkxgIga29SoJ4VNwkzkiOkQiOsyyXMrMUwSN0W73U,5065
158
158
  c2cgeoportal_geoportal/views/pdfreport.py,sha256=0cNXsfUmIlbvsgjVyg7031cY6OBwA6c6bAfYvSDMeRE,9576
159
- c2cgeoportal_geoportal/views/printproxy.py,sha256=DxKQkb87k3HMm7hfhdmxjYFR3v67WEGaVFlXv5mezGM,5897
159
+ c2cgeoportal_geoportal/views/printproxy.py,sha256=buHwibEfM2mm88F3-CNjeiykpHeCz0FtT5r1Y8mEt_g,5965
160
160
  c2cgeoportal_geoportal/views/profile.py,sha256=9ZXIsjJoV3_uRx0H3iQ0256xiu5OpIaMPAMmKEbaBuk,5394
161
- c2cgeoportal_geoportal/views/proxy.py,sha256=mxvBva4oEGh6O5IT2Q6BTzftl-P2_MhNIiVe3j6Ar8Q,10453
161
+ c2cgeoportal_geoportal/views/proxy.py,sha256=0PWwckJdU5EXGLaa27yLBZimBSU2DiMO4VcVsCE2MmI,10490
162
162
  c2cgeoportal_geoportal/views/raster.py,sha256=7diNkV-YGtg4di_QDV-Bbbe6phB76bPYLnmnE4ZBXc0,7570
163
163
  c2cgeoportal_geoportal/views/resourceproxy.py,sha256=aKOJUOI5Em2Z3BI61I2br_sUmx8ospFv_RExxmqkyXA,3181
164
164
  c2cgeoportal_geoportal/views/shortener.py,sha256=I9GjjlkR9sX5CwsRSsY9PLjyLue_c_nHgVrFnh3gTBQ,6206
@@ -178,8 +178,8 @@ tests/test_mapserverproxy_route_predicate.py,sha256=CrYzEnYjowvDJxJp56gEAaUEk5vX
178
178
  tests/test_raster.py,sha256=oRyOc90WixD9Y-iR3pMdkHuR0JwKART9DxNH5QwyilM,12074
179
179
  tests/test_wmstparsing.py,sha256=ZAlL6OQkYmzFTKu70OQ6Xej-7ZNB7UltSs2V_PbXDac,9135
180
180
  tests/xmlstr.py,sha256=vIvIFWIE2GFUMfAtG0hTMZC2jx-pQBuzOOq2FjQlyjA,6010
181
- c2cgeoportal_geoportal-2.7.1.140.dist-info/METADATA,sha256=4Lsc-wd6X-D0JJG_LRmbY8LpHrtgm91kRBBWmdqgvZI,2036
182
- c2cgeoportal_geoportal-2.7.1.140.dist-info/WHEEL,sha256=a-zpFRIJzOq5QfuhBzbhiA1eHTzNCJn8OdRvhdNX0Rk,110
183
- c2cgeoportal_geoportal-2.7.1.140.dist-info/entry_points.txt,sha256=_EqfKA_CKejpkgK0xWDTB9K8an0TKqIWHoyCJrRpU80,1414
184
- c2cgeoportal_geoportal-2.7.1.140.dist-info/top_level.txt,sha256=PJIbY7Nx51dDrJ052f5mDA7c6Tehm5aD-Gb32L_CtJA,29
185
- c2cgeoportal_geoportal-2.7.1.140.dist-info/RECORD,,
181
+ c2cgeoportal_geoportal-2.7.1.141.dist-info/METADATA,sha256=jFy1vkCeY-PJTB8pEIGRc-55BUQ_AvVjrrRlWBc1w6U,2036
182
+ c2cgeoportal_geoportal-2.7.1.141.dist-info/WHEEL,sha256=a-zpFRIJzOq5QfuhBzbhiA1eHTzNCJn8OdRvhdNX0Rk,110
183
+ c2cgeoportal_geoportal-2.7.1.141.dist-info/entry_points.txt,sha256=_EqfKA_CKejpkgK0xWDTB9K8an0TKqIWHoyCJrRpU80,1414
184
+ c2cgeoportal_geoportal-2.7.1.141.dist-info/top_level.txt,sha256=PJIbY7Nx51dDrJ052f5mDA7c6Tehm5aD-Gb32L_CtJA,29
185
+ c2cgeoportal_geoportal-2.7.1.141.dist-info/RECORD,,