arthexis 0.1.13__py3-none-any.whl → 0.1.14__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 arthexis might be problematic. Click here for more details.
- {arthexis-0.1.13.dist-info → arthexis-0.1.14.dist-info}/METADATA +222 -221
- arthexis-0.1.14.dist-info/RECORD +109 -0
- {arthexis-0.1.13.dist-info → arthexis-0.1.14.dist-info}/licenses/LICENSE +674 -674
- config/__init__.py +5 -5
- config/active_app.py +15 -15
- config/asgi.py +43 -43
- config/auth_app.py +7 -7
- config/celery.py +32 -32
- config/context_processors.py +67 -69
- config/horologia_app.py +7 -7
- config/loadenv.py +11 -11
- config/logging.py +59 -48
- config/middleware.py +25 -25
- config/offline.py +49 -49
- config/settings.py +691 -682
- config/settings_helpers.py +109 -109
- config/urls.py +171 -166
- config/wsgi.py +17 -17
- core/admin.py +3771 -2809
- core/admin_history.py +50 -50
- core/admindocs.py +151 -151
- core/apps.py +356 -272
- core/auto_upgrade.py +57 -57
- core/backends.py +265 -236
- core/changelog.py +342 -0
- core/entity.py +133 -133
- core/environment.py +61 -61
- core/fields.py +168 -168
- core/form_fields.py +75 -75
- core/github_helper.py +188 -25
- core/github_issues.py +178 -172
- core/github_repos.py +72 -0
- core/lcd_screen.py +78 -78
- core/liveupdate.py +25 -25
- core/log_paths.py +100 -100
- core/mailer.py +85 -85
- core/middleware.py +91 -91
- core/models.py +3609 -2795
- core/notifications.py +105 -105
- core/public_wifi.py +267 -227
- core/reference_utils.py +108 -108
- core/release.py +721 -368
- core/rfid_import_export.py +113 -0
- core/sigil_builder.py +149 -149
- core/sigil_context.py +20 -20
- core/sigil_resolver.py +315 -315
- core/system.py +752 -493
- core/tasks.py +408 -394
- core/temp_passwords.py +181 -181
- core/test_system_info.py +186 -139
- core/tests.py +2095 -1521
- core/tests_liveupdate.py +17 -17
- core/urls.py +11 -11
- core/user_data.py +641 -633
- core/views.py +2175 -1417
- core/widgets.py +213 -94
- core/workgroup_urls.py +17 -17
- core/workgroup_views.py +94 -94
- nodes/admin.py +1720 -1161
- nodes/apps.py +87 -85
- nodes/backends.py +160 -160
- nodes/dns.py +203 -203
- nodes/feature_checks.py +133 -133
- nodes/lcd.py +165 -165
- nodes/models.py +1737 -1597
- nodes/reports.py +411 -411
- nodes/rfid_sync.py +195 -0
- nodes/signals.py +18 -0
- nodes/tasks.py +46 -46
- nodes/tests.py +3810 -3116
- nodes/urls.py +15 -14
- nodes/utils.py +121 -105
- nodes/views.py +683 -619
- ocpp/admin.py +948 -948
- ocpp/apps.py +25 -25
- ocpp/consumers.py +1565 -1459
- ocpp/evcs.py +844 -844
- ocpp/evcs_discovery.py +158 -158
- ocpp/models.py +917 -917
- ocpp/reference_utils.py +42 -42
- ocpp/routing.py +11 -11
- ocpp/simulator.py +745 -745
- ocpp/status_display.py +26 -26
- ocpp/store.py +601 -541
- ocpp/tasks.py +31 -31
- ocpp/test_export_import.py +130 -130
- ocpp/test_rfid.py +913 -702
- ocpp/tests.py +4445 -4094
- ocpp/transactions_io.py +189 -189
- ocpp/urls.py +50 -50
- ocpp/views.py +1479 -1251
- pages/admin.py +708 -539
- pages/apps.py +10 -10
- pages/checks.py +40 -40
- pages/context_processors.py +127 -119
- pages/defaults.py +13 -13
- pages/forms.py +198 -198
- pages/middleware.py +205 -153
- pages/models.py +607 -426
- pages/tests.py +2612 -2200
- pages/urls.py +25 -25
- pages/utils.py +12 -12
- pages/views.py +1165 -1128
- arthexis-0.1.13.dist-info/RECORD +0 -105
- nodes/actions.py +0 -70
- {arthexis-0.1.13.dist-info → arthexis-0.1.14.dist-info}/WHEEL +0 -0
- {arthexis-0.1.13.dist-info → arthexis-0.1.14.dist-info}/top_level.txt +0 -0
core/middleware.py
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
from django.contrib.auth import get_user_model
|
|
2
|
-
from django.contrib.contenttypes.models import ContentType
|
|
3
|
-
from django.contrib.sites.models import Site
|
|
4
|
-
from django.urls import resolve
|
|
5
|
-
|
|
6
|
-
from nodes.models import Node, NodeRole
|
|
7
|
-
|
|
8
|
-
from .models import AdminHistory
|
|
9
|
-
from .sigil_context import set_context, clear_context
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class AdminHistoryMiddleware:
|
|
13
|
-
"""Log recently visited admin changelists for each user."""
|
|
14
|
-
|
|
15
|
-
def __init__(self, get_response):
|
|
16
|
-
self.get_response = get_response
|
|
17
|
-
|
|
18
|
-
def __call__(self, request):
|
|
19
|
-
response = self.get_response(request)
|
|
20
|
-
match = getattr(request, "resolver_match", None)
|
|
21
|
-
if (
|
|
22
|
-
request.user.is_authenticated
|
|
23
|
-
and request.user.is_staff
|
|
24
|
-
and request.method == "GET"
|
|
25
|
-
and match
|
|
26
|
-
and match.url_name
|
|
27
|
-
and match.url_name.endswith("_changelist")
|
|
28
|
-
and response.status_code == 200
|
|
29
|
-
):
|
|
30
|
-
parts = request.path.strip("/").split("/")
|
|
31
|
-
if len(parts) >= 3:
|
|
32
|
-
app_label, model_name = parts[1], parts[2]
|
|
33
|
-
content_type = ContentType.objects.get_by_natural_key(
|
|
34
|
-
app_label, model_name
|
|
35
|
-
)
|
|
36
|
-
AdminHistory.objects.update_or_create(
|
|
37
|
-
user=request.user,
|
|
38
|
-
url=request.get_full_path(),
|
|
39
|
-
defaults={"content_type": content_type},
|
|
40
|
-
)
|
|
41
|
-
return response
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class SigilContextMiddleware:
|
|
45
|
-
"""Capture model instance identifiers from resolved views."""
|
|
46
|
-
|
|
47
|
-
def __init__(self, get_response):
|
|
48
|
-
self.get_response = get_response
|
|
49
|
-
|
|
50
|
-
def __call__(self, request):
|
|
51
|
-
context = {}
|
|
52
|
-
if request.user.is_authenticated:
|
|
53
|
-
context[get_user_model()] = request.user.pk
|
|
54
|
-
try:
|
|
55
|
-
site = Site.objects.get_current(request)
|
|
56
|
-
context[Site] = site.pk
|
|
57
|
-
except Exception:
|
|
58
|
-
pass
|
|
59
|
-
if hasattr(request, "node") and getattr(request, "node", None):
|
|
60
|
-
context[Node] = request.node.pk
|
|
61
|
-
if hasattr(request, "role") and getattr(request, "role", None):
|
|
62
|
-
context[NodeRole] = request.role.pk
|
|
63
|
-
try:
|
|
64
|
-
match = resolve(request.path_info)
|
|
65
|
-
except Exception: # pragma: no cover - resolution errors
|
|
66
|
-
match = None
|
|
67
|
-
if match and hasattr(match, "func"):
|
|
68
|
-
view = match.func
|
|
69
|
-
model = None
|
|
70
|
-
if hasattr(view, "view_class"):
|
|
71
|
-
view_class = view.view_class
|
|
72
|
-
model = getattr(view_class, "model", None)
|
|
73
|
-
if model is None:
|
|
74
|
-
queryset = getattr(view_class, "queryset", None)
|
|
75
|
-
if queryset is not None:
|
|
76
|
-
model = queryset.model
|
|
77
|
-
if model is not None:
|
|
78
|
-
pk = match.kwargs.get("pk") or match.kwargs.get("id")
|
|
79
|
-
if pk is not None:
|
|
80
|
-
context[model] = pk
|
|
81
|
-
for field in model._meta.fields:
|
|
82
|
-
if field.is_relation:
|
|
83
|
-
for key in (field.name, field.attname):
|
|
84
|
-
if key in match.kwargs:
|
|
85
|
-
context[field.related_model] = match.kwargs[key]
|
|
86
|
-
break
|
|
87
|
-
set_context(context)
|
|
88
|
-
try:
|
|
89
|
-
return self.get_response(request)
|
|
90
|
-
finally:
|
|
91
|
-
clear_context()
|
|
1
|
+
from django.contrib.auth import get_user_model
|
|
2
|
+
from django.contrib.contenttypes.models import ContentType
|
|
3
|
+
from django.contrib.sites.models import Site
|
|
4
|
+
from django.urls import resolve
|
|
5
|
+
|
|
6
|
+
from nodes.models import Node, NodeRole
|
|
7
|
+
|
|
8
|
+
from .models import AdminHistory
|
|
9
|
+
from .sigil_context import set_context, clear_context
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class AdminHistoryMiddleware:
|
|
13
|
+
"""Log recently visited admin changelists for each user."""
|
|
14
|
+
|
|
15
|
+
def __init__(self, get_response):
|
|
16
|
+
self.get_response = get_response
|
|
17
|
+
|
|
18
|
+
def __call__(self, request):
|
|
19
|
+
response = self.get_response(request)
|
|
20
|
+
match = getattr(request, "resolver_match", None)
|
|
21
|
+
if (
|
|
22
|
+
request.user.is_authenticated
|
|
23
|
+
and request.user.is_staff
|
|
24
|
+
and request.method == "GET"
|
|
25
|
+
and match
|
|
26
|
+
and match.url_name
|
|
27
|
+
and match.url_name.endswith("_changelist")
|
|
28
|
+
and response.status_code == 200
|
|
29
|
+
):
|
|
30
|
+
parts = request.path.strip("/").split("/")
|
|
31
|
+
if len(parts) >= 3:
|
|
32
|
+
app_label, model_name = parts[1], parts[2]
|
|
33
|
+
content_type = ContentType.objects.get_by_natural_key(
|
|
34
|
+
app_label, model_name
|
|
35
|
+
)
|
|
36
|
+
AdminHistory.objects.update_or_create(
|
|
37
|
+
user=request.user,
|
|
38
|
+
url=request.get_full_path(),
|
|
39
|
+
defaults={"content_type": content_type},
|
|
40
|
+
)
|
|
41
|
+
return response
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class SigilContextMiddleware:
|
|
45
|
+
"""Capture model instance identifiers from resolved views."""
|
|
46
|
+
|
|
47
|
+
def __init__(self, get_response):
|
|
48
|
+
self.get_response = get_response
|
|
49
|
+
|
|
50
|
+
def __call__(self, request):
|
|
51
|
+
context = {}
|
|
52
|
+
if request.user.is_authenticated:
|
|
53
|
+
context[get_user_model()] = request.user.pk
|
|
54
|
+
try:
|
|
55
|
+
site = Site.objects.get_current(request)
|
|
56
|
+
context[Site] = site.pk
|
|
57
|
+
except Exception:
|
|
58
|
+
pass
|
|
59
|
+
if hasattr(request, "node") and getattr(request, "node", None):
|
|
60
|
+
context[Node] = request.node.pk
|
|
61
|
+
if hasattr(request, "role") and getattr(request, "role", None):
|
|
62
|
+
context[NodeRole] = request.role.pk
|
|
63
|
+
try:
|
|
64
|
+
match = resolve(request.path_info)
|
|
65
|
+
except Exception: # pragma: no cover - resolution errors
|
|
66
|
+
match = None
|
|
67
|
+
if match and hasattr(match, "func"):
|
|
68
|
+
view = match.func
|
|
69
|
+
model = None
|
|
70
|
+
if hasattr(view, "view_class"):
|
|
71
|
+
view_class = view.view_class
|
|
72
|
+
model = getattr(view_class, "model", None)
|
|
73
|
+
if model is None:
|
|
74
|
+
queryset = getattr(view_class, "queryset", None)
|
|
75
|
+
if queryset is not None:
|
|
76
|
+
model = queryset.model
|
|
77
|
+
if model is not None:
|
|
78
|
+
pk = match.kwargs.get("pk") or match.kwargs.get("id")
|
|
79
|
+
if pk is not None:
|
|
80
|
+
context[model] = pk
|
|
81
|
+
for field in model._meta.fields:
|
|
82
|
+
if field.is_relation:
|
|
83
|
+
for key in (field.name, field.attname):
|
|
84
|
+
if key in match.kwargs:
|
|
85
|
+
context[field.related_model] = match.kwargs[key]
|
|
86
|
+
break
|
|
87
|
+
set_context(context)
|
|
88
|
+
try:
|
|
89
|
+
return self.get_response(request)
|
|
90
|
+
finally:
|
|
91
|
+
clear_context()
|