fresco 3.3.4__py3-none-any.whl → 3.4.0__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.
Potentially problematic release.
This version of fresco might be problematic. Click here for more details.
- fresco/__init__.py +1 -1
- fresco/options.py +5 -3
- fresco/routing.py +9 -0
- fresco/tests/test_routing.py +17 -0
- {fresco-3.3.4.dist-info → fresco-3.4.0.dist-info}/METADATA +1 -1
- {fresco-3.3.4.dist-info → fresco-3.4.0.dist-info}/RECORD +9 -9
- {fresco-3.3.4.dist-info → fresco-3.4.0.dist-info}/WHEEL +1 -1
- {fresco-3.3.4.dist-info → fresco-3.4.0.dist-info}/LICENSE.txt +0 -0
- {fresco-3.3.4.dist-info → fresco-3.4.0.dist-info}/top_level.txt +0 -0
fresco/__init__.py
CHANGED
fresco/options.py
CHANGED
|
@@ -217,9 +217,11 @@ class Options(dict):
|
|
|
217
217
|
for ts in sorted(
|
|
218
218
|
tagged_sources,
|
|
219
219
|
key=(
|
|
220
|
-
lambda ts: (
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
lambda ts: (
|
|
221
|
+
([], ts[1])
|
|
222
|
+
if len(ts[0]) == 0 else
|
|
223
|
+
(sorted(tags.index(t) for t in ts[0]), ts[1])
|
|
224
|
+
)
|
|
223
225
|
)
|
|
224
226
|
)
|
|
225
227
|
]
|
fresco/routing.py
CHANGED
|
@@ -107,6 +107,9 @@ ALL_METHODS = HTTP_METHODS = set(
|
|
|
107
107
|
+ RFC5789_METHODS
|
|
108
108
|
)
|
|
109
109
|
|
|
110
|
+
#: Shortcut for specifying all methods as a kwarg
|
|
111
|
+
ALL = "ALL"
|
|
112
|
+
|
|
110
113
|
__all__ = [
|
|
111
114
|
"ALL_METHODS",
|
|
112
115
|
"Pattern",
|
|
@@ -803,10 +806,16 @@ class Route(object):
|
|
|
803
806
|
"HTTP methods must be specified as a string or iterable"
|
|
804
807
|
)
|
|
805
808
|
for m in methods:
|
|
809
|
+
if m == ALL:
|
|
810
|
+
methods = ALL_METHODS
|
|
811
|
+
break
|
|
806
812
|
if m not in ALL_METHODS:
|
|
807
813
|
raise ValueError("{!r} is not a valid HTTP method".format(m))
|
|
808
814
|
method_view_map.update((m, view) for m in methods)
|
|
809
815
|
|
|
816
|
+
if view := _kwargs.pop("ALL", None):
|
|
817
|
+
method_view_map |= {m: view for m in ALL_METHODS}
|
|
818
|
+
|
|
810
819
|
for method in ALL_METHODS:
|
|
811
820
|
if method in _kwargs:
|
|
812
821
|
method_view_map[method] = _kwargs.pop(method)
|
fresco/tests/test_routing.py
CHANGED
|
@@ -27,7 +27,9 @@ from fresco.core import urlfor
|
|
|
27
27
|
from fresco.exceptions import NotFound
|
|
28
28
|
from fresco.response import Response
|
|
29
29
|
from fresco.routing import ALL_METHODS
|
|
30
|
+
from fresco.routing import ALL
|
|
30
31
|
from fresco.routing import GET
|
|
32
|
+
from fresco.routing import OPTIONS
|
|
31
33
|
from fresco.routing import POST
|
|
32
34
|
from fresco.routing import (
|
|
33
35
|
Route,
|
|
@@ -114,6 +116,21 @@ class TestRouteConstructor(object):
|
|
|
114
116
|
with pytest.raises(ValueError):
|
|
115
117
|
Route("/", ["GET", "FOO"], lambda: None)
|
|
116
118
|
|
|
119
|
+
def test_ALL_kwarg_routes_all_methods(self):
|
|
120
|
+
def view():
|
|
121
|
+
return Response()
|
|
122
|
+
|
|
123
|
+
app = FrescoApp()
|
|
124
|
+
app.route("/x", ALL, view)
|
|
125
|
+
assert len(list(app.get_route_traversals("/x", GET))) == 1
|
|
126
|
+
assert len(list(app.get_route_traversals("/x", POST))) == 1
|
|
127
|
+
assert len(list(app.get_route_traversals("/x", OPTIONS))) == 1
|
|
128
|
+
|
|
129
|
+
app.route("/y", ALL=view)
|
|
130
|
+
assert len(list(app.get_route_traversals("/y", GET))) == 1
|
|
131
|
+
assert len(list(app.get_route_traversals("/y", POST))) == 1
|
|
132
|
+
assert len(list(app.get_route_traversals("/y", OPTIONS))) == 1
|
|
133
|
+
|
|
117
134
|
|
|
118
135
|
class TestRouteBeforeHooks(object):
|
|
119
136
|
def test_hook_is_called(self):
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
fresco/__init__.py,sha256=
|
|
1
|
+
fresco/__init__.py,sha256=rteQgLzbeRKgdSkiDL_0ey72k3neyI5FtDIG8LR9vxA,3520
|
|
2
2
|
fresco/cookie.py,sha256=Qnx8yOjU4LUJ1fqi7YvqbhAA01rCsclJGl_fxI68slw,7055
|
|
3
3
|
fresco/core.py,sha256=mwYR6UP0zRSjcFlNZf51-otX9EcmvgjEZ7GDVQoQexg,26615
|
|
4
4
|
fresco/decorators.py,sha256=84NUpRJ-M7GK6wDl42bmCRSvgoWzCsy1huyvGnSAPPw,3232
|
|
5
5
|
fresco/exceptions.py,sha256=KE-LoYUGnho6KltzkU6cnm9vUiUhAiDIjPqn5ba-YCA,4410
|
|
6
6
|
fresco/middleware.py,sha256=uCAuOtBnvaVBJGrQa8ecvLkSZ6aSKmWaJqxB8Rv4SsQ,4173
|
|
7
7
|
fresco/multidict.py,sha256=0CaNNIcFnZ1hLk3NExhNvjc_BtK4zVB26L9gP_7MeNM,13362
|
|
8
|
-
fresco/options.py,sha256=
|
|
8
|
+
fresco/options.py,sha256=Z1EZPRoEAqYHm2hg7gRmLtMWMKWjNgGVehPtCU66mBE,14068
|
|
9
9
|
fresco/request.py,sha256=dC7pMg-4Kxa6PcqaaWFL4JviANQotuBjoKwlxZYywRY,27048
|
|
10
10
|
fresco/requestcontext.py,sha256=P-SkKJkKLYVqNiR2zwooRROnSnE2VMj2P2-eD5DW5Qg,3504
|
|
11
11
|
fresco/response.py,sha256=ADKHbtAGyhwtaUJxB7m_1nqVdZRKUryebmG4FDUjZVY,37072
|
|
12
12
|
fresco/routeargs.py,sha256=dxNlqbQ1FrgIY6OCFzcEMdZ0OVyjlMQdQGLmUJgdPYU,10176
|
|
13
|
-
fresco/routing.py,sha256=
|
|
13
|
+
fresco/routing.py,sha256=S33ysM6BJEKxWZh7mdPO6-Eep2t1s0Q_qlrev84iNIY,58977
|
|
14
14
|
fresco/static.py,sha256=9SKQ3P1YFTP45Qiic-ycvkpKRvqIURp1XSzPazTmYLI,2513
|
|
15
15
|
fresco/subrequests.py,sha256=wFJWLuhVAcei5imYc5NBSCBaHBEm-X4_XswPtK3O4Zw,11081
|
|
16
16
|
fresco/types.py,sha256=UHITRMDoS90s2zV2wNpqLFhRWESfaBAMuQnL4c21mqY,106
|
|
@@ -28,7 +28,7 @@ fresco/tests/test_request.py,sha256=hoANrergrohlAeTbQufDMfIbvYURsPyPjCxOVKz7bVo,
|
|
|
28
28
|
fresco/tests/test_requestcontext.py,sha256=t8hm-lzIk85ryb3sdlpVoPQyLDWpCjB86dg8nVG1yRw,3115
|
|
29
29
|
fresco/tests/test_response.py,sha256=MrhHIDg81pJlTeEcn2rGtU-i59s1KzEccF81u4Up6xs,8934
|
|
30
30
|
fresco/tests/test_routeargs.py,sha256=VMWUbrXegTLN9Tx2AcrpbjAAEaxAANzkcy02SmpFOmY,8162
|
|
31
|
-
fresco/tests/test_routing.py,sha256=
|
|
31
|
+
fresco/tests/test_routing.py,sha256=nOg3daHL8UigPEykHzgLKmlTOYtD4n_VjoBVfMsQcYo,38565
|
|
32
32
|
fresco/tests/test_static.py,sha256=y73dqzE2flpACQ_dvNhDzk_WlvNQfkhYF_8YY4MMGDo,4686
|
|
33
33
|
fresco/tests/test_subrequests.py,sha256=7rluJnw-elXRXfrzvAQvGBHRBU93zwnL827mTxBGd3Y,7909
|
|
34
34
|
fresco/tests/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -50,8 +50,8 @@ fresco/util/security.py,sha256=nXEdoCak_2c4OA1L1wGwhZygS22s2fzwR0Kp-DdwKZg,1058
|
|
|
50
50
|
fresco/util/textproc.py,sha256=e5jLTofKCqdm6_Fy8XOyR43AJr5APtL59Kd8cNA9PrQ,2309
|
|
51
51
|
fresco/util/urls.py,sha256=aaVovLyXNlVoGviiLN94ImqXf-LTQs_xooEIyi3LBc4,9195
|
|
52
52
|
fresco/util/wsgi.py,sha256=2cr2b92RpvPSgS_P46X2mlYepoFg9Qji-V-fzxpSNzw,12971
|
|
53
|
-
fresco-3.
|
|
54
|
-
fresco-3.
|
|
55
|
-
fresco-3.
|
|
56
|
-
fresco-3.
|
|
57
|
-
fresco-3.
|
|
53
|
+
fresco-3.4.0.dist-info/LICENSE.txt,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
54
|
+
fresco-3.4.0.dist-info/METADATA,sha256=Kk7LvAhriUF3HHAIb0ZFoTyADsgD_Czx3arDrYQCVoU,1549
|
|
55
|
+
fresco-3.4.0.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
|
56
|
+
fresco-3.4.0.dist-info/top_level.txt,sha256=p_1aMce5Shjq9fIfdbB-aN8wCDhjF_iYnn98bUebbII,7
|
|
57
|
+
fresco-3.4.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|