arthexis 0.1.8__py3-none-any.whl → 0.1.10__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.

Files changed (84) hide show
  1. {arthexis-0.1.8.dist-info → arthexis-0.1.10.dist-info}/METADATA +87 -6
  2. arthexis-0.1.10.dist-info/RECORD +95 -0
  3. arthexis-0.1.10.dist-info/licenses/LICENSE +674 -0
  4. config/__init__.py +0 -1
  5. config/auth_app.py +0 -1
  6. config/celery.py +1 -2
  7. config/context_processors.py +1 -1
  8. config/offline.py +2 -0
  9. config/settings.py +352 -37
  10. config/urls.py +71 -6
  11. core/admin.py +1601 -200
  12. core/admin_history.py +50 -0
  13. core/admindocs.py +108 -1
  14. core/apps.py +161 -3
  15. core/auto_upgrade.py +57 -0
  16. core/backends.py +123 -7
  17. core/entity.py +62 -48
  18. core/fields.py +98 -0
  19. core/github_helper.py +25 -0
  20. core/github_issues.py +172 -0
  21. core/lcd_screen.py +1 -0
  22. core/liveupdate.py +25 -0
  23. core/log_paths.py +100 -0
  24. core/mailer.py +83 -0
  25. core/middleware.py +57 -0
  26. core/models.py +1279 -267
  27. core/notifications.py +11 -1
  28. core/public_wifi.py +227 -0
  29. core/reference_utils.py +97 -0
  30. core/release.py +27 -20
  31. core/sigil_builder.py +144 -0
  32. core/sigil_context.py +20 -0
  33. core/sigil_resolver.py +284 -0
  34. core/system.py +162 -29
  35. core/tasks.py +269 -27
  36. core/test_system_info.py +59 -1
  37. core/tests.py +644 -73
  38. core/tests_liveupdate.py +17 -0
  39. core/urls.py +2 -2
  40. core/user_data.py +425 -168
  41. core/views.py +627 -59
  42. core/widgets.py +51 -0
  43. core/workgroup_urls.py +7 -3
  44. core/workgroup_views.py +43 -6
  45. nodes/actions.py +0 -2
  46. nodes/admin.py +168 -285
  47. nodes/apps.py +9 -15
  48. nodes/backends.py +145 -0
  49. nodes/lcd.py +24 -10
  50. nodes/models.py +579 -179
  51. nodes/tasks.py +1 -5
  52. nodes/tests.py +894 -130
  53. nodes/utils.py +13 -2
  54. nodes/views.py +204 -28
  55. ocpp/admin.py +212 -63
  56. ocpp/apps.py +1 -1
  57. ocpp/consumers.py +642 -68
  58. ocpp/evcs.py +30 -10
  59. ocpp/models.py +452 -70
  60. ocpp/simulator.py +75 -11
  61. ocpp/store.py +288 -30
  62. ocpp/tasks.py +11 -7
  63. ocpp/test_export_import.py +8 -7
  64. ocpp/test_rfid.py +211 -16
  65. ocpp/tests.py +1576 -137
  66. ocpp/transactions_io.py +68 -22
  67. ocpp/urls.py +35 -2
  68. ocpp/views.py +701 -123
  69. pages/admin.py +173 -13
  70. pages/checks.py +0 -1
  71. pages/context_processors.py +39 -6
  72. pages/forms.py +131 -0
  73. pages/middleware.py +153 -0
  74. pages/models.py +37 -9
  75. pages/tests.py +1182 -42
  76. pages/urls.py +4 -0
  77. pages/utils.py +0 -1
  78. pages/views.py +844 -51
  79. arthexis-0.1.8.dist-info/RECORD +0 -80
  80. arthexis-0.1.8.dist-info/licenses/LICENSE +0 -21
  81. config/workgroup_app.py +0 -7
  82. core/checks.py +0 -29
  83. {arthexis-0.1.8.dist-info → arthexis-0.1.10.dist-info}/WHEEL +0 -0
  84. {arthexis-0.1.8.dist-info → arthexis-0.1.10.dist-info}/top_level.txt +0 -0
core/middleware.py CHANGED
@@ -1,5 +1,12 @@
1
+ from django.contrib.auth import get_user_model
1
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
+
2
8
  from .models import AdminHistory
9
+ from .sigil_context import set_context, clear_context
3
10
 
4
11
 
5
12
  class AdminHistoryMiddleware:
@@ -32,3 +39,53 @@ class AdminHistoryMiddleware:
32
39
  defaults={"content_type": content_type},
33
40
  )
34
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()