plain 0.32.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-0.32.0.dist-info → plain-0.32.1.dist-info}/METADATA +1 -1
- {plain-0.32.0.dist-info → plain-0.32.1.dist-info}/RECORD +6 -6
- {plain-0.32.0.dist-info → plain-0.32.1.dist-info}/WHEEL +0 -0
- {plain-0.32.0.dist-info → plain-0.32.1.dist-info}/entry_points.txt +0 -0
- {plain-0.32.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.
|
@@ -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
|
@@ -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.32.
|
138
|
-
plain-0.32.
|
139
|
-
plain-0.32.
|
140
|
-
plain-0.32.
|
141
|
-
plain-0.32.
|
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
|