arthexis 0.1.23__py3-none-any.whl → 0.1.25__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.23.dist-info → arthexis-0.1.25.dist-info}/METADATA +39 -18
- {arthexis-0.1.23.dist-info → arthexis-0.1.25.dist-info}/RECORD +31 -30
- config/settings.py +7 -0
- config/urls.py +2 -0
- core/admin.py +140 -213
- core/backends.py +3 -1
- core/models.py +612 -207
- core/system.py +67 -2
- core/tasks.py +25 -0
- core/views.py +0 -3
- nodes/admin.py +465 -292
- nodes/models.py +299 -23
- nodes/tasks.py +13 -16
- nodes/tests.py +291 -130
- nodes/urls.py +11 -0
- nodes/utils.py +9 -2
- nodes/views.py +588 -20
- ocpp/admin.py +729 -175
- ocpp/consumers.py +98 -0
- ocpp/models.py +299 -0
- ocpp/network.py +398 -0
- ocpp/tasks.py +177 -1
- ocpp/tests.py +179 -0
- ocpp/views.py +2 -0
- pages/middleware.py +3 -2
- pages/tests.py +40 -0
- pages/utils.py +70 -0
- pages/views.py +64 -32
- {arthexis-0.1.23.dist-info → arthexis-0.1.25.dist-info}/WHEEL +0 -0
- {arthexis-0.1.23.dist-info → arthexis-0.1.25.dist-info}/licenses/LICENSE +0 -0
- {arthexis-0.1.23.dist-info → arthexis-0.1.25.dist-info}/top_level.txt +0 -0
nodes/utils.py
CHANGED
|
@@ -90,10 +90,13 @@ def save_screenshot(
|
|
|
90
90
|
*,
|
|
91
91
|
content: str | None = None,
|
|
92
92
|
user=None,
|
|
93
|
+
link_duplicates: bool = False,
|
|
93
94
|
):
|
|
94
95
|
"""Save screenshot file info if not already recorded.
|
|
95
96
|
|
|
96
|
-
Returns the created :class:`ContentSample
|
|
97
|
+
Returns the created :class:`ContentSample`. If ``link_duplicates`` is ``True``
|
|
98
|
+
and a sample with identical content already exists, the existing record is
|
|
99
|
+
returned instead of ``None``.
|
|
97
100
|
"""
|
|
98
101
|
|
|
99
102
|
original = path
|
|
@@ -101,7 +104,11 @@ def save_screenshot(
|
|
|
101
104
|
path = settings.LOG_DIR / path
|
|
102
105
|
with path.open("rb") as fh:
|
|
103
106
|
digest = hashlib.sha256(fh.read()).hexdigest()
|
|
104
|
-
|
|
107
|
+
existing = ContentSample.objects.filter(hash=digest).first()
|
|
108
|
+
if existing:
|
|
109
|
+
if link_duplicates:
|
|
110
|
+
logger.info("Duplicate screenshot content; reusing existing sample")
|
|
111
|
+
return existing
|
|
105
112
|
logger.info("Duplicate screenshot content; record not created")
|
|
106
113
|
return None
|
|
107
114
|
stored_path = (original if not original.is_absolute() else path).as_posix()
|