c2cgeoportal-geoportal 2.9.0.208__py3-none-any.whl → 2.9.0.211__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.
- c2cgeoportal_geoportal/__init__.py +1 -0
- c2cgeoportal_geoportal/views/shortener.py +15 -5
- {c2cgeoportal_geoportal-2.9.0.208.dist-info → c2cgeoportal_geoportal-2.9.0.211.dist-info}/METADATA +1 -1
- {c2cgeoportal_geoportal-2.9.0.208.dist-info → c2cgeoportal_geoportal-2.9.0.211.dist-info}/RECORD +7 -7
- {c2cgeoportal_geoportal-2.9.0.208.dist-info → c2cgeoportal_geoportal-2.9.0.211.dist-info}/WHEEL +0 -0
- {c2cgeoportal_geoportal-2.9.0.208.dist-info → c2cgeoportal_geoportal-2.9.0.211.dist-info}/entry_points.txt +0 -0
- {c2cgeoportal_geoportal-2.9.0.208.dist-info → c2cgeoportal_geoportal-2.9.0.211.dist-info}/top_level.txt +0 -0
@@ -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-
|
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
|
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
|
-
|
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
|
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]:
|
{c2cgeoportal_geoportal-2.9.0.208.dist-info → c2cgeoportal_geoportal-2.9.0.211.dist-info}/RECORD
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
c2cgeoportal_geoportal/__init__.py,sha256=
|
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=
|
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.
|
191
|
-
c2cgeoportal_geoportal-2.9.0.
|
192
|
-
c2cgeoportal_geoportal-2.9.0.
|
193
|
-
c2cgeoportal_geoportal-2.9.0.
|
194
|
-
c2cgeoportal_geoportal-2.9.0.
|
190
|
+
c2cgeoportal_geoportal-2.9.0.211.dist-info/METADATA,sha256=0WHKUVSglzb3pHkxu3H9j4hqzJPSTfajD8kC1HN1KBk,1923
|
191
|
+
c2cgeoportal_geoportal-2.9.0.211.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
192
|
+
c2cgeoportal_geoportal-2.9.0.211.dist-info/entry_points.txt,sha256=3dnX260FsLX_AubeNMdyeta_z1X4CxcD3steAlfPx2I,1414
|
193
|
+
c2cgeoportal_geoportal-2.9.0.211.dist-info/top_level.txt,sha256=PJIbY7Nx51dDrJ052f5mDA7c6Tehm5aD-Gb32L_CtJA,29
|
194
|
+
c2cgeoportal_geoportal-2.9.0.211.dist-info/RECORD,,
|
{c2cgeoportal_geoportal-2.9.0.208.dist-info → c2cgeoportal_geoportal-2.9.0.211.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|
File without changes
|