plain 0.31.0__py3-none-any.whl → 0.32.1__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.
- plain/preflight/urls.py +1 -48
- plain/urls/patterns.py +0 -2
- {plain-0.31.0.dist-info → plain-0.32.1.dist-info}/METADATA +1 -1
- {plain-0.31.0.dist-info → plain-0.32.1.dist-info}/RECORD +7 -7
- {plain-0.31.0.dist-info → plain-0.32.1.dist-info}/WHEEL +0 -0
- {plain-0.31.0.dist-info → plain-0.32.1.dist-info}/entry_points.txt +0 -0
- {plain-0.31.0.dist-info → plain-0.32.1.dist-info}/licenses/LICENSE +0 -0
plain/preflight/urls.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
from collections import Counter
|
2
|
-
|
3
1
|
from plain.runtime import settings
|
4
2
|
|
5
|
-
from . import Error,
|
3
|
+
from . import Error, register
|
6
4
|
|
7
5
|
|
8
6
|
@register
|
@@ -29,51 +27,6 @@ def check_resolver(resolver):
|
|
29
27
|
return []
|
30
28
|
|
31
29
|
|
32
|
-
@register
|
33
|
-
def check_url_namespaces_unique(package_configs, **kwargs):
|
34
|
-
"""
|
35
|
-
Warn if URL namespaces used in applications aren't unique.
|
36
|
-
"""
|
37
|
-
if not getattr(settings, "URLS_ROUTER", None):
|
38
|
-
return []
|
39
|
-
|
40
|
-
from plain.urls import get_resolver
|
41
|
-
|
42
|
-
resolver = get_resolver()
|
43
|
-
all_namespaces = _load_all_namespaces(resolver)
|
44
|
-
counter = Counter(all_namespaces)
|
45
|
-
non_unique_namespaces = [n for n, count in counter.items() if count > 1]
|
46
|
-
errors = []
|
47
|
-
for namespace in non_unique_namespaces:
|
48
|
-
errors.append(
|
49
|
-
Warning(
|
50
|
-
f"URL namespace '{namespace}' isn't unique. You may not be able to reverse "
|
51
|
-
"all URLs in this namespace",
|
52
|
-
id="urls.W005",
|
53
|
-
)
|
54
|
-
)
|
55
|
-
return errors
|
56
|
-
|
57
|
-
|
58
|
-
def _load_all_namespaces(resolver, parents=()):
|
59
|
-
"""
|
60
|
-
Recursively load all namespaces from URL patterns.
|
61
|
-
"""
|
62
|
-
url_patterns = getattr(resolver, "url_patterns", [])
|
63
|
-
namespaces = [
|
64
|
-
":".join(parents + (url.namespace,))
|
65
|
-
for url in url_patterns
|
66
|
-
if getattr(url, "namespace", None) is not None
|
67
|
-
]
|
68
|
-
for pattern in url_patterns:
|
69
|
-
namespace = getattr(pattern, "namespace", None)
|
70
|
-
current = parents
|
71
|
-
if namespace is not None:
|
72
|
-
current += (namespace,)
|
73
|
-
namespaces.extend(_load_all_namespaces(pattern, current))
|
74
|
-
return namespaces
|
75
|
-
|
76
|
-
|
77
30
|
def get_warning_for_invalid_pattern(pattern):
|
78
31
|
"""
|
79
32
|
Return a list containing a warning that the pattern is invalid.
|
plain/urls/patterns.py
CHANGED
@@ -48,7 +48,6 @@ class CheckURLMixin:
|
|
48
48
|
class RegexPattern(CheckURLMixin):
|
49
49
|
def __init__(self, regex, name=None, is_endpoint=False):
|
50
50
|
self._regex = regex
|
51
|
-
self._regex_dict = {}
|
52
51
|
self._is_endpoint = is_endpoint
|
53
52
|
self.name = name
|
54
53
|
self.converters = {}
|
@@ -157,7 +156,6 @@ def _route_to_regex(route, is_endpoint=False):
|
|
157
156
|
class RoutePattern(CheckURLMixin):
|
158
157
|
def __init__(self, route, name=None, is_endpoint=False):
|
159
158
|
self._route = route
|
160
|
-
self._regex_dict = {}
|
161
159
|
self._is_endpoint = is_endpoint
|
162
160
|
self.name = name
|
163
161
|
self.converters = _route_to_regex(str(route), is_endpoint)[1]
|
@@ -69,7 +69,7 @@ plain/preflight/files.py,sha256=wbHCNgps7o1c1zQNBd8FDCaVaqX90UwuvLgEQ_DbUpY,510
|
|
69
69
|
plain/preflight/messages.py,sha256=HwatjA6MRFfzFAnSOa_uAw1Pvk_CLuNfW3IYi71_1Mk,2322
|
70
70
|
plain/preflight/registry.py,sha256=7s7f_iEwURzv-Ye515P5lJWcHltd5Ca2fsX1Wpbf1wQ,2306
|
71
71
|
plain/preflight/security.py,sha256=sNpv5AHobPcaO48cOUGRNe2EjusTducjY8vyShR8EhI,2645
|
72
|
-
plain/preflight/urls.py,sha256=
|
72
|
+
plain/preflight/urls.py,sha256=O8KtBK8XsM-F2GkvIgnGOqkYWYFgv0fgx0wwmWb8b1M,1456
|
73
73
|
plain/runtime/README.md,sha256=Q8VVO7JRGuYrDxzuYL6ptoilhclbecxKzpRXKgbWGkU,2061
|
74
74
|
plain/runtime/__init__.py,sha256=o2RVETiL8U0lMFBpbtfnxflhw_4MFllMV6CEpX3RqZs,1965
|
75
75
|
plain/runtime/global_settings.py,sha256=DUx_RPZsyplBV9i8sDy7S1fZdU9LUuxqnXYEBTOMzEI,5490
|
@@ -95,7 +95,7 @@ plain/urls/README.md,sha256=pWnCvgYkWN7rG7hSyBOtX4ZUP3iO7FhqM6lvwwYll6c,33
|
|
95
95
|
plain/urls/__init__.py,sha256=DFO2OL1IllHW5USPIb5uYvvzf_G-Bl0Qu1zrRLHmWyM,542
|
96
96
|
plain/urls/converters.py,sha256=s2JZVOdzZC16lgobsI93hygcdH5L0Kj4742WEkXsVcs,1193
|
97
97
|
plain/urls/exceptions.py,sha256=q4iPh3Aa-zHbA-tw8v6WyX1J1n5WdAady2xvxFuyXB0,114
|
98
|
-
plain/urls/patterns.py,sha256=
|
98
|
+
plain/urls/patterns.py,sha256=Vswc5OVVQLvvlhVQpHbAsUZ1apy8pucHfTH_h0MDg5g,9298
|
99
99
|
plain/urls/resolvers.py,sha256=PyqbO1JIoJq2ayCSmONW_6O8a3vM7cTVbqQJdCJHIK0,15218
|
100
100
|
plain/urls/routers.py,sha256=iEsQtTpPNDDVn7r_BQX84FESGSjOeD5qgyO_ep5rzaU,2819
|
101
101
|
plain/urls/utils.py,sha256=WiGq6hHI-5DLFOxCQTAZ2qm0J-UdGosLcjuxlfK6_Tg,2137
|
@@ -134,8 +134,8 @@ plain/views/forms.py,sha256=RhlaUcZCkeqokY_fvv-NOS-kgZAG4XhDLOPbf9K_Zlc,2691
|
|
134
134
|
plain/views/objects.py,sha256=g5Lzno0Zsv0K449UpcCtxwCoO7WMRAWqKlxxV2V0_qg,8263
|
135
135
|
plain/views/redirect.py,sha256=9zHZgKvtSkdrMX9KmsRM8hJTPmBktxhc4d8OitbuniI,1724
|
136
136
|
plain/views/templates.py,sha256=cBkFNCSXgVi8cMqQbhsqJ4M_rIQYVl8cUvq9qu4YIes,1951
|
137
|
-
plain-0.
|
138
|
-
plain-0.
|
139
|
-
plain-0.
|
140
|
-
plain-0.
|
141
|
-
plain-0.
|
137
|
+
plain-0.32.1.dist-info/METADATA,sha256=4vh2UUkUGv4-dwa6wFT_JBg62zHtUaPwYNfY2lwiZVk,319
|
138
|
+
plain-0.32.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
139
|
+
plain-0.32.1.dist-info/entry_points.txt,sha256=1Ys2lsSeMepD1vz8RSrJopna0RQfUd951vYvCRsvl6A,45
|
140
|
+
plain-0.32.1.dist-info/licenses/LICENSE,sha256=m0D5O7QoH9l5Vz_rrX_9r-C8d9UNr_ciK6Qwac7o6yo,3175
|
141
|
+
plain-0.32.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|