c2cgeoportal-geoportal 2.9rc28__py3-none-any.whl → 2.9rc29__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.
@@ -66,9 +66,11 @@ class CachebusterTween:
66
66
  self.cache_path = registry.settings["cache_path"]
67
67
 
68
68
  def __call__(self, request: pyramid.request.Request) -> pyramid.response.Response:
69
- path = request.path_info.split("/")
69
+ path = request.path_info.split("/", 3)
70
70
  if len(path) > 1 and path[1] in self.cache_path:
71
- # remove the cache buster
71
+ if len(path) == 2:
72
+ raise pyramid.httpexceptions.HTTPNotFound()
73
+ # Remove the cache buster
72
74
  path.pop(2)
73
75
  request.path_info = "/".join(path)
74
76
 
@@ -26,7 +26,6 @@
26
26
  # either expressed or implied, of the FreeBSD Project.
27
27
 
28
28
 
29
- import json
30
29
  import os
31
30
  import re
32
31
  import subprocess
@@ -35,7 +34,7 @@ from argparse import ArgumentParser
35
34
  from typing import Any, Union, cast
36
35
 
37
36
  import pkg_resources
38
- import requests
37
+ import pyproj
39
38
  import yaml
40
39
  from cookiecutter.log import configure_logger
41
40
  from cookiecutter.main import cookiecutter
@@ -277,31 +276,14 @@ class PCreateCommand:
277
276
  @staticmethod
278
277
  def epsg2bbox(srid: int) -> list[str] | None:
279
278
  try:
280
- r = requests.get(f"https://epsg.io/?format=json&q={srid}", timeout=60)
281
- bbox = r.json()["results"][0]["bbox"]
282
- r = requests.get(
283
- "https://epsg.io/trans?s_srs=4326&t_srs={srid}&data={bbox[1]},{bbox[0]}".format(
284
- srid=srid, bbox=bbox
285
- ),
286
- timeout=60,
287
- )
288
- r1 = r.json()[0]
289
- r = requests.get(
290
- "https://epsg.io/trans?s_srs=4326&t_srs={srid}&data={bbox[3]},{bbox[2]}".format(
291
- srid=srid, bbox=bbox
292
- ),
293
- timeout=60,
294
- )
295
- r2 = r.json()[0]
296
- return [r1["x"], r2["y"], r2["x"], r1["y"]]
297
- except requests.RequestException:
298
- print("Failed to establish a connection to epsg.io.")
299
- except json.JSONDecodeError:
300
- print("epsg.io doesn't return a correct json.")
301
- except IndexError:
302
- print("Unable to get the bbox")
279
+ crs = pyproj.CRS.from_epsg(srid)
280
+ assert crs.area_of_use is not None
281
+ transformer = pyproj.Transformer.from_crs(4326, crs)
282
+ c1 = transformer.transform(crs.area_of_use.bounds[1], crs.area_of_use.bounds[0])
283
+ c2 = transformer.transform(crs.area_of_use.bounds[3], crs.area_of_use.bounds[2])
284
+ return [c1[0], c1[1], c2[0], c2[1]]
303
285
  except Exception as exception: # pylint: disable=broad-exception-caught
304
- print(f"unexpected error: {str(exception)}")
286
+ print(f"Unexpected error: {str(exception)}")
305
287
  return None
306
288
 
307
289
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: c2cgeoportal-geoportal
3
- Version: 2.9rc28
3
+ Version: 2.9rc29
4
4
  Summary: c2cgeoportal geoportal
5
5
  Home-page: https://github.com/camptocamp/c2cgeoportal/
6
6
  Author: Camptocamp
@@ -4,7 +4,7 @@ c2cgeoportal_geoportal/resources.py,sha256=n42Gns8DKw32GstDoUdNgud6xdAidaRwgAuNH
4
4
  c2cgeoportal_geoportal/lib/__init__.py,sha256=_67fO_aXQZRnxPXcShHBcs38mdYU5ch0FNX89RwMTgA,10431
5
5
  c2cgeoportal_geoportal/lib/authentication.py,sha256=Bfws50nNiboVa2qm3Hdy_-38tygnlB8sX5AW9Zfikw0,9833
6
6
  c2cgeoportal_geoportal/lib/bashcolor.py,sha256=LQgOgtFUvgJ4Ed3-YW3RPjvhBMZBbXBBkUZKE4unRCI,1889
7
- c2cgeoportal_geoportal/lib/cacheversion.py,sha256=8ETNA02fh7AX39pNAkDrEJsCmPXVzYRShjTzJHoAJL0,2946
7
+ c2cgeoportal_geoportal/lib/cacheversion.py,sha256=jc8jIKH_yE1NReC2kvUkTkpGERHObdWjPp6kGCWAU1o,3040
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
@@ -144,7 +144,7 @@ c2cgeoportal_geoportal/scripts/__init__.py,sha256=hHwjhQaM_T2EaupeFIyjl0N67Bcl3M
144
144
  c2cgeoportal_geoportal/scripts/c2cupgrade.py,sha256=7smnq2yxs1hAF1CiyE9WfgAqNKjjtrtHevY321i-wio,36826
145
145
  c2cgeoportal_geoportal/scripts/create_demo_theme.py,sha256=-SL-fvAPjgiJZEKYcbhXsZm713txhtWQB18X231k6xQ,3263
146
146
  c2cgeoportal_geoportal/scripts/manage_users.py,sha256=Ih3X_V_xUw59Ums4a1x6qQQtz9VtE7PaxAj-tiZIOPg,5586
147
- c2cgeoportal_geoportal/scripts/pcreate.py,sha256=1zy-khluuf2gnqA_hJAFy6HFBxDdrqf-__iSZx4R9rs,11588
147
+ c2cgeoportal_geoportal/scripts/pcreate.py,sha256=AcBIGBQJCvr5fch6HbseKuOCBEpuwr_3w6uokuREZJM,10984
148
148
  c2cgeoportal_geoportal/scripts/theme2fts.py,sha256=Tx1jUfDUwNtwZ5TCyfpldZIbIkzZiQ3dq-kv_YQ9yFE,13737
149
149
  c2cgeoportal_geoportal/scripts/urllogin.py,sha256=qGOOvx2ZN3qnENGzo8NScRqfFC06l1yc48vU6Qx3MBo,3319
150
150
  c2cgeoportal_geoportal/templates/login.html,sha256=Jy8CUw2KrSviePknsvWJLDqCUXam-vPhnMUv7UcD4Pc,2475
@@ -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.9rc28.dist-info/METADATA,sha256=Sm57rHnvZ1swZ8nMjFcXIp1KIZHiEWlzWCb3SdnxPb4,1886
189
- c2cgeoportal_geoportal-2.9rc28.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
190
- c2cgeoportal_geoportal-2.9rc28.dist-info/entry_points.txt,sha256=3dnX260FsLX_AubeNMdyeta_z1X4CxcD3steAlfPx2I,1414
191
- c2cgeoportal_geoportal-2.9rc28.dist-info/top_level.txt,sha256=PJIbY7Nx51dDrJ052f5mDA7c6Tehm5aD-Gb32L_CtJA,29
192
- c2cgeoportal_geoportal-2.9rc28.dist-info/RECORD,,
188
+ c2cgeoportal_geoportal-2.9rc29.dist-info/METADATA,sha256=a4eQ7IyhzUSkPtl31Tu7pi1HikW6eZw0t9-l4bwgI5Q,1886
189
+ c2cgeoportal_geoportal-2.9rc29.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
190
+ c2cgeoportal_geoportal-2.9rc29.dist-info/entry_points.txt,sha256=3dnX260FsLX_AubeNMdyeta_z1X4CxcD3steAlfPx2I,1414
191
+ c2cgeoportal_geoportal-2.9rc29.dist-info/top_level.txt,sha256=PJIbY7Nx51dDrJ052f5mDA7c6Tehm5aD-Gb32L_CtJA,29
192
+ c2cgeoportal_geoportal-2.9rc29.dist-info/RECORD,,