meringue 1.3.0.dev0__tar.gz → 1.3.0.dev1__tar.gz
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.
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/PKG-INFO +3 -8
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/README.md +2 -4
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/__init__.py +1 -1
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/thumbnail/drf_fields.py +24 -14
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/thumbnail/images.py +1 -1
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/pyproject.toml +8 -8
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/.gitignore +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/AUTHORS +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/LICENSE +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/api/__init__.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/api/apps.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/api/docs/__init__.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/api/docs/patchers.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/api/docs/views.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/api/handlers.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/api/routers.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/api/utils.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/conf/__init__.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/conf/default_settings.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/core/__init__.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/core/apps.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/core/db.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/core/locale/en/LC_MESSAGES/django.po +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/core/locale/ru/LC_MESSAGES/django.po +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/core/models.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/core/options.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/core/query.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/core/templatetags/__init__.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/core/templatetags/meringue_base.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/core/translation.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/core/upload_handlers.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/core/utils/__init__.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/core/utils/crypt.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/core/utils/datetime.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/core/utils/frontend.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/core/views.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/protected/__init__.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/protected/apps.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/protected/fields.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/protected/utils.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/protected/views.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/thumbnail/__init__.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/thumbnail/actions.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/thumbnail/apps.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/thumbnail/constants.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/thumbnail/exceptions.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/thumbnail/generators.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/thumbnail/properties.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/thumbnail/shortcuts.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/thumbnail/storage.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/thumbnail/templatetags/__init__.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/thumbnail/templatetags/m_thumbnails.py +0 -0
- {meringue-1.3.0.dev0 → meringue-1.3.0.dev1}/meringue/thumbnail/types.py +0 -0
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: meringue
|
|
3
|
-
Version: 1.3.0.
|
|
3
|
+
Version: 1.3.0.dev1
|
|
4
4
|
Summary: A set of various functionality for a Django based web application.
|
|
5
5
|
Project-URL: Documentation, https://dd.github.io/Meringue
|
|
6
6
|
Project-URL: Repository, https://github.com/dd/Meringue
|
|
7
7
|
Project-URL: Changelog, https://github.com/dd/Meringue/blob/master/CHANGELOG.md
|
|
8
8
|
Project-URL: Bug Tracker, https://github.com/dd/Meringue/issues
|
|
9
9
|
Author-email: Dmitry Dobrynin <dd@tovarisch.engineer>
|
|
10
|
-
License-Expression: LGPL-3.0
|
|
11
|
-
License-File: AUTHORS
|
|
12
|
-
License-File: LICENSE
|
|
13
10
|
Keywords: django,utils
|
|
14
11
|
Classifier: Development Status :: 5 - Production/Stable
|
|
15
12
|
Classifier: Environment :: Plugins
|
|
@@ -115,11 +112,9 @@ Description-Content-Type: text/markdown
|
|
|
115
112
|
</a>
|
|
116
113
|
</p>
|
|
117
114
|
|
|
118
|
-
|
|
115
|
+
A package providing various utilities for Django, such as mixins, form tools, upload handlers, and more.
|
|
119
116
|
|
|
120
|
-
This library is a
|
|
121
|
-
|
|
122
|
-
The main task of this package is to clean up this functionality, test it, and also organize the documentation so that colleagues can understand how and what works.
|
|
117
|
+
This library is a collection of reusable components that I frequently use across different projects. Its primary purpose is to clean up and standardize these tools, ensure they are well-tested, and provide clear documentation to make it easy for colleagues to understand and use.
|
|
123
118
|
|
|
124
119
|
However, if someone decides to use this functionality in their project, and even more so to add functionality or change the implementation to a more correct, beautiful or understandable one, I will only be happy, do not worry and feel free to write to me by [mail](mailto:dd@tovarisch.engineer), create an [issue](https://github.com/dd/Meringue/issues) or [pull request](https://github.com/dd/Meringue/pulls) on [github](https://github.com/dd/Meringue).
|
|
125
120
|
|
|
@@ -55,11 +55,9 @@
|
|
|
55
55
|
</a>
|
|
56
56
|
</p>
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
A package providing various utilities for Django, such as mixins, form tools, upload handlers, and more.
|
|
59
59
|
|
|
60
|
-
This library is a
|
|
61
|
-
|
|
62
|
-
The main task of this package is to clean up this functionality, test it, and also organize the documentation so that colleagues can understand how and what works.
|
|
60
|
+
This library is a collection of reusable components that I frequently use across different projects. Its primary purpose is to clean up and standardize these tools, ensure they are well-tested, and provide clear documentation to make it easy for colleagues to understand and use.
|
|
63
61
|
|
|
64
62
|
However, if someone decides to use this functionality in their project, and even more so to add functionality or change the implementation to a more correct, beautiful or understandable one, I will only be happy, do not worry and feel free to write to me by [mail](mailto:dd@tovarisch.engineer), create an [issue](https://github.com/dd/Meringue/issues) or [pull request](https://github.com/dd/Meringue/pulls) on [github](https://github.com/dd/Meringue).
|
|
65
63
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
import
|
|
3
|
-
from pathlib import PurePath
|
|
2
|
+
from pathlib import Path
|
|
4
3
|
|
|
5
4
|
from rest_framework.fields import ImageField
|
|
6
5
|
|
|
@@ -13,7 +12,7 @@ logger = logging.getLogger("meringue.thumbnail")
|
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
def get_format_from_path(path):
|
|
16
|
-
return FORMATS_BY_EXTENSIONS[
|
|
15
|
+
return FORMATS_BY_EXTENSIONS[path.suffix.lower()]
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
class BaseImageField(ImageField):
|
|
@@ -53,13 +52,15 @@ class MImageField(BaseImageField):
|
|
|
53
52
|
if not value:
|
|
54
53
|
return None
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
path = Path(value.path)
|
|
56
|
+
|
|
57
|
+
if path.exists():
|
|
58
|
+
thumbnail = DefaultThumbnailer(path, job_chain=self.job_chain)
|
|
59
|
+
optimized_image_url = thumbnail.get_image(get_format_from_path(path)).url
|
|
59
60
|
result = optimized_image_url
|
|
60
61
|
|
|
61
62
|
else:
|
|
62
|
-
logger.error(f"File `{
|
|
63
|
+
logger.error(f"File `{path}` not found")
|
|
63
64
|
result = _dummyimage([])
|
|
64
65
|
|
|
65
66
|
return result
|
|
@@ -76,16 +77,23 @@ class MImageSetField(ImageField):
|
|
|
76
77
|
def __init__(
|
|
77
78
|
self,
|
|
78
79
|
size=None,
|
|
79
|
-
dimensions=
|
|
80
|
+
dimensions=(1, 2),
|
|
80
81
|
base_job_chain=None,
|
|
81
82
|
job_chains=None,
|
|
82
83
|
**kwargs,
|
|
83
84
|
):
|
|
84
|
-
if
|
|
85
|
-
msg = "Need to set
|
|
85
|
+
if size and job_chains:
|
|
86
|
+
msg = "Need to set 'size' or 'job_chains' attribute (not both)."
|
|
86
87
|
raise Exception(msg)
|
|
87
88
|
|
|
88
89
|
elif size:
|
|
90
|
+
if not dimensions:
|
|
91
|
+
msg = (
|
|
92
|
+
"If you specify the 'sizes' attribute, "
|
|
93
|
+
"then the 'dimensions' attribute cannot be empty."
|
|
94
|
+
)
|
|
95
|
+
raise Exception(msg)
|
|
96
|
+
|
|
89
97
|
self.job_chains = {}
|
|
90
98
|
|
|
91
99
|
if 1 not in dimensions:
|
|
@@ -147,8 +155,10 @@ class MImageSetField(ImageField):
|
|
|
147
155
|
if not value:
|
|
148
156
|
return None
|
|
149
157
|
|
|
150
|
-
|
|
151
|
-
|
|
158
|
+
path = Path(value.path)
|
|
159
|
+
|
|
160
|
+
if not path.exists():
|
|
161
|
+
logger.error(f"File `{path}` not found")
|
|
152
162
|
return [
|
|
153
163
|
{
|
|
154
164
|
"url": _dummyimage(self.job_chains[1]),
|
|
@@ -156,11 +166,11 @@ class MImageSetField(ImageField):
|
|
|
156
166
|
},
|
|
157
167
|
]
|
|
158
168
|
|
|
159
|
-
original_format = get_format_from_path(
|
|
169
|
+
original_format = get_format_from_path(path)
|
|
160
170
|
result = []
|
|
161
171
|
|
|
162
172
|
for dimension, job_chain in self.job_chains.items():
|
|
163
|
-
thumbnail = DefaultThumbnailer(
|
|
173
|
+
thumbnail = DefaultThumbnailer(path, job_chain=job_chain)
|
|
164
174
|
original = thumbnail.get_image(original_format)
|
|
165
175
|
webp_thumbnail = thumbnail.get_image("WEBP")
|
|
166
176
|
|
|
@@ -131,7 +131,7 @@ class ThumbnailImage(AltersData):
|
|
|
131
131
|
if self.out_format == constants.FORMAT_WEBP:
|
|
132
132
|
return "image/webp"
|
|
133
133
|
|
|
134
|
-
guess_type = mimetypes.guess_type(
|
|
134
|
+
guess_type = mimetypes.guess_type(self.filename)
|
|
135
135
|
return guess_type[0]
|
|
136
136
|
|
|
137
137
|
@property
|
|
@@ -241,18 +241,18 @@ description = "Docs environment"
|
|
|
241
241
|
detached = true
|
|
242
242
|
python = "3.12"
|
|
243
243
|
dependencies = [
|
|
244
|
-
"mkdocs[i18n]==1.
|
|
244
|
+
"mkdocs[i18n]==1.6.1",
|
|
245
245
|
"mkdocs-literate-nav==0.6.1",
|
|
246
|
-
"mkdocs-material==9.5.
|
|
247
|
-
"mkdocs-git-revision-date-localized-plugin==1.2.
|
|
246
|
+
"mkdocs-material==9.5.40",
|
|
247
|
+
"mkdocs-git-revision-date-localized-plugin==1.2.9",
|
|
248
248
|
"mkdocs-git-authors-plugin==0.9.0",
|
|
249
|
-
"mkdocstrings[python]==0.
|
|
250
|
-
"black==24.
|
|
249
|
+
"mkdocstrings[python]==0.26.1",
|
|
250
|
+
"black==24.10.0",
|
|
251
251
|
"mkdocs-minify-plugin==0.8.0",
|
|
252
252
|
"mkdocs-gen-files==0.5.0",
|
|
253
253
|
"Pygments==2.18.0",
|
|
254
|
-
"mike==2.1.
|
|
255
|
-
"linkchecker==10.
|
|
254
|
+
"mike==2.1.3",
|
|
255
|
+
"linkchecker==10.5.0",
|
|
256
256
|
]
|
|
257
257
|
[tool.hatch.envs.docs.env-vars]
|
|
258
258
|
MERINGUE_MKDOCS_ENABLE_MINIFY = "false"
|
|
@@ -260,7 +260,7 @@ MKDOCS_CONFIG = "mkdocs.yml"
|
|
|
260
260
|
[tool.hatch.envs.docs.scripts]
|
|
261
261
|
build = "mkdocs build --config-file {env:MKDOCS_CONFIG} --clean --strict {args}"
|
|
262
262
|
serve = "mkdocs serve --config-file {env:MKDOCS_CONFIG} --dev-addr localhost:8000 {args}"
|
|
263
|
-
ci-build = "mike deploy --config-file {env:MKDOCS_CONFIG}
|
|
263
|
+
ci-build = "mike deploy --config-file {env:MKDOCS_CONFIG} {args}"
|
|
264
264
|
validate = "linkchecker --config .linkcheckerrc docs/dist"
|
|
265
265
|
build-check = [
|
|
266
266
|
"build --no-directory-urls",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|