c2cgeoportal-geoportal 2.9.0.206__py3-none-any.whl → 2.9.0.210__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.
@@ -783,6 +783,7 @@ def includeme(config: pyramid.config.Configurator) -> None:
783
783
  add_cors_route(config, "/short/create", "shortener")
784
784
  config.add_route("shortener_create", "/short/create", request_method="POST")
785
785
  config.add_route("shortener_get", "/s/{ref}", request_method="GET")
786
+ config.add_route("shortener_fetch", "/short/get/{ref}", request_method="GET")
786
787
 
787
788
  # Geometry processing
788
789
  config.add_route("difference", "/difference", request_method="POST")
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2013-2024, Camptocamp SA
1
+ # Copyright (c) 2013-2025, Camptocamp SA
2
2
  # All rights reserved.
3
3
 
4
4
  # Redistribution and use in source and binary forms, with or without
@@ -46,7 +46,7 @@ logger = logging.getLogger(__name__)
46
46
 
47
47
 
48
48
  class Shortener:
49
- """All the views conserne the shortener."""
49
+ """All the views concern the shortener."""
50
50
 
51
51
  def __init__(self, request: pyramid.request.Request):
52
52
  self.request = request
@@ -55,8 +55,7 @@ class Shortener:
55
55
  if "base_url" in self.settings:
56
56
  self.short_bases.append(self.settings["base_url"])
57
57
 
58
- @view_config(route_name="shortener_get") # type: ignore[misc]
59
- def get(self) -> HTTPFound:
58
+ def _read(self) -> str:
60
59
  assert DBSession is not None
61
60
 
62
61
  ref = self.request.matchdict["ref"]
@@ -68,8 +67,19 @@ class Shortener:
68
67
  short_urls[0].nb_hits += 1
69
68
  short_urls[0].last_hit = datetime.now()
70
69
 
70
+ return short_urls[0].url
71
+
72
+ @view_config(route_name="shortener_get") # type: ignore[misc]
73
+ def get(self) -> HTTPFound:
74
+ long_url = self._read()
75
+ set_common_headers(self.request, "shortener", Cache.PUBLIC_NO)
76
+ return HTTPFound(location=long_url)
77
+
78
+ @view_config(route_name="shortener_fetch", renderer="json") # type: ignore[misc]
79
+ def fetch(self) -> dict[str, str]:
80
+ long_url = self._read()
71
81
  set_common_headers(self.request, "shortener", Cache.PUBLIC_NO)
72
- return HTTPFound(location=short_urls[0].url)
82
+ return {"long_url": long_url}
73
83
 
74
84
  @view_config(route_name="shortener_create", renderer="json") # type: ignore[misc]
75
85
  def create(self) -> dict[str, str]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: c2cgeoportal-geoportal
3
- Version: 2.9.0.206
3
+ Version: 2.9.0.210
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=DMoU-3sCR_yJb-dCddKrLfVA3MKiel8fy7byGBHbM5w,39988
1
+ c2cgeoportal_geoportal/__init__.py,sha256=hPoVL78ef1gwRn_thABVX63JpQ8huWorCJ6N4LtoR50,40070
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
@@ -170,7 +170,7 @@ c2cgeoportal_geoportal/views/profile.py,sha256=tVQxJ3_eS5HcDCzQm5Loq5WEH62GtMc--
170
170
  c2cgeoportal_geoportal/views/proxy.py,sha256=XxOGR8Snqrd1CKkUiK4IjavCR8PiUsd3tlEM9lZE9TI,10468
171
171
  c2cgeoportal_geoportal/views/raster.py,sha256=kY6rYo4SxQP9JLbsq3_kdWdbaTVkdQDdpjrG9lUtAIM,9242
172
172
  c2cgeoportal_geoportal/views/resourceproxy.py,sha256=pcHwU6hAXHeh_Ef6tuHxpRzGje8nqVKUxyZwZKOPCjI,3189
173
- c2cgeoportal_geoportal/views/shortener.py,sha256=t-05vHSbsp6aIYV6fKk-ic6Zo45TLePIlGnPAzwrzQU,6179
173
+ c2cgeoportal_geoportal/views/shortener.py,sha256=7_yQYPhtm-ddCLILnh2c0_WCgUq1D3bLhgyscGuTGUg,6530
174
174
  c2cgeoportal_geoportal/views/theme.py,sha256=npI1Z-Z3304ZrLDnCOwxbQGTA0D9AsTr70VIEpJ1lVY,55862
175
175
  c2cgeoportal_geoportal/views/tinyowsproxy.py,sha256=_wPN1Vfo4RNcCQ1xRPU_funie7mDPocL-ox_4hlF1-Y,8178
176
176
  c2cgeoportal_geoportal/views/vector_tiles.py,sha256=2bF3j6WvOpXAJULsEfy7pfeUBeKVheMlcUOWzHVow90,3575
@@ -187,8 +187,8 @@ tests/test_mapserverproxy_route_predicate.py,sha256=SzILSSzIuilzIkUYVPZiVzLwW1du
187
187
  tests/test_raster.py,sha256=82NJ2MXgZlMqs0ytN-VgNw376iURdk4PkAg__dyh5ns,11948
188
188
  tests/test_wmstparsing.py,sha256=xjA8nJuXFl3H5Bfs4sJw_8qX8E8qvAALK7Hs2-DTP2A,9054
189
189
  tests/xmlstr.py,sha256=rkTKSU4FGjupBKLx75H8o-goB0KbQrxDvdpc6xVX_uQ,5985
190
- c2cgeoportal_geoportal-2.9.0.206.dist-info/METADATA,sha256=q-C8SMc1PUrAF5jz7aap48H_26NabSFD__E3uCWwxrM,1923
191
- c2cgeoportal_geoportal-2.9.0.206.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
192
- c2cgeoportal_geoportal-2.9.0.206.dist-info/entry_points.txt,sha256=3dnX260FsLX_AubeNMdyeta_z1X4CxcD3steAlfPx2I,1414
193
- c2cgeoportal_geoportal-2.9.0.206.dist-info/top_level.txt,sha256=PJIbY7Nx51dDrJ052f5mDA7c6Tehm5aD-Gb32L_CtJA,29
194
- c2cgeoportal_geoportal-2.9.0.206.dist-info/RECORD,,
190
+ c2cgeoportal_geoportal-2.9.0.210.dist-info/METADATA,sha256=l9ShpbGGSwdEWCUXmoLnHLXNUiy5x2ZPhgxEwvyrMqc,1923
191
+ c2cgeoportal_geoportal-2.9.0.210.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
192
+ c2cgeoportal_geoportal-2.9.0.210.dist-info/entry_points.txt,sha256=3dnX260FsLX_AubeNMdyeta_z1X4CxcD3steAlfPx2I,1414
193
+ c2cgeoportal_geoportal-2.9.0.210.dist-info/top_level.txt,sha256=PJIbY7Nx51dDrJ052f5mDA7c6Tehm5aD-Gb32L_CtJA,29
194
+ c2cgeoportal_geoportal-2.9.0.210.dist-info/RECORD,,