imio.smartweb.common 1.2.34__py3-none-any.whl → 1.2.35__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.
@@ -31,16 +31,20 @@ class ImageContenttypeValidator:
31
31
  self.value = value
32
32
 
33
33
  def __call__(self):
34
+ return self.validate_image()
35
+
36
+ def validate_image(self):
34
37
  if self.value is None:
35
- return
38
+ return False
36
39
  mimetype = get_image_format(self.value)
37
40
 
38
- valid_mimetypes = [
41
+ valid_mimetypes = {
39
42
  "image/gif",
40
43
  "image/jpeg",
41
44
  "image/png",
42
45
  "image/svg+xml",
43
46
  "image/webp",
44
- ]
47
+ }
45
48
  if mimetype not in valid_mimetypes:
46
49
  raise InvalidImageFile(mimetype, self.field.__name__)
50
+ return True
@@ -223,6 +223,8 @@ def _get_pil_mimetype(pil_image):
223
223
 
224
224
  def get_image_format(named_blob_image):
225
225
  """Détecte le format d'une image à partir de son contenu binaire."""
226
+ if hasattr(named_blob_image, "contentType"):
227
+ return named_blob_image.contentType
226
228
  if named_blob_image and named_blob_image.data:
227
229
  try:
228
230
  with Image.open(BytesIO(named_blob_image.data)) as img:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: imio.smartweb.common
3
- Version: 1.2.34
3
+ Version: 1.2.35
4
4
  Summary: Common utilities, vocabularies, taxonomies for imio.smartweb & co products
5
5
  Home-page: https://github.com/imio/imio.smartweb.common
6
6
  Author: iMio
@@ -178,6 +178,13 @@ Changelog
178
178
  =========
179
179
 
180
180
 
181
+ 1.2.35 (2025-05-26)
182
+ -------------------
183
+
184
+ - CITI-7 : Fix retrieving mimeType for some picture files
185
+ [boulch]
186
+
187
+
181
188
  1.2.34 (2025-05-26)
182
189
  -------------------
183
190
 
@@ -1,6 +1,6 @@
1
- imio.smartweb.common-1.2.34-py3.13-nspkg.pth,sha256=XZ3YhlzwpUCC8tXtelHRqxVxo3NWomIiMsUfUshrbeE,1011
1
+ imio.smartweb.common-1.2.35-py3.12-nspkg.pth,sha256=XZ3YhlzwpUCC8tXtelHRqxVxo3NWomIiMsUfUshrbeE,1011
2
2
  imio/smartweb/common/__init__.py,sha256=Na9XBfEQUMrm2c5jbqQgwWeg40ih0aXVG1vT8NeAjMQ,2709
3
- imio/smartweb/common/adapters.py,sha256=BjnzwhRhSYXziKUzmNTRBOXqDv4k8C8kfmwqZE7r1yU,1413
3
+ imio/smartweb/common/adapters.py,sha256=dG4MALuHPQI6lTeNvs5p4vVOxHoBBYaWN6g8J96KxzQ,1507
4
4
  imio/smartweb/common/adapters.zcml,sha256=VO3luZDtRL9FIIEghxPrqpx8paZF3m6MGEy-8kF1sOQ,437
5
5
  imio/smartweb/common/caching.py,sha256=aN7gX9rT63fnmUuZnx82Mbu3ghjJUeOiLvLEp9OiFm4,895
6
6
  imio/smartweb/common/caching_overrides.zcml,sha256=ysa5DgVGzO1Fp22d9Wg-vNyLlqfRR77WBV-7L6j0Hpo,526
@@ -20,7 +20,7 @@ imio/smartweb/common/subscribers.zcml,sha256=8v2lqNNVAHlrh2G3jtjVgr3Asrw8WJLS9jS
20
20
  imio/smartweb/common/testing.py,sha256=GKlYMHJUSxZFVX0o_R_c_Au1VYlkd-GjykQqfONHv7I,1985
21
21
  imio/smartweb/common/testing.zcml,sha256=7N-ALtklyWeLSzZmlxN2Tp-aZe_3An--w_6BGl1991E,172
22
22
  imio/smartweb/common/utility_overrides.zcml,sha256=Nn1q1FwQUyktB-EJM2qzPfsc-zUmHxX0Gj9OQTlYKQM,413
23
- imio/smartweb/common/utils.py,sha256=sSq72k41ELmlW5jc7JkRgKLXKQbbd68-87JtEDHmTCQ,7738
23
+ imio/smartweb/common/utils.py,sha256=bQaR1i9_dID2_QKmHImZfJhWOYzK8AzFtI43-IG7xPo,7831
24
24
  imio/smartweb/common/vocabularies.py,sha256=QRIOWLOALzZDM92o1iUTWgDBBcrdd9BYz7miNjpYCDA,3835
25
25
  imio/smartweb/common/vocabularies.zcml,sha256=iFJer5q3wabBp_EZivPPVUqI1_9w5P_Ft1RGJB5Yqxs,940
26
26
  imio/smartweb/common/widgets.zcml,sha256=GQ0aJblx44OJpj0HGXiyQJnFeSaJlOTMd1RAZn_1Qgk,375
@@ -146,10 +146,10 @@ imio/smartweb/common/viewlets/skip_to_content.py,sha256=wm22NUf8Qh5uzz8p4vkLCdFN
146
146
  imio/smartweb/common/widgets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
147
147
  imio/smartweb/common/widgets/select.py,sha256=5sV0UIgwu4AvwpgVmJeSZwUWz7OPD9VxYMowfmjcfbA,1313
148
148
  imio/smartweb/common/widgets/templates/ajaxselect_display.pt,sha256=v8TT2Xc19er6SUGWabgNfIdrayFYIjxyLK9H_XkIG3M,1209
149
- imio_smartweb_common-1.2.34.dist-info/licenses/LICENSE.GPL,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
150
- imio_smartweb_common-1.2.34.dist-info/licenses/LICENSE.rst,sha256=5dd78Fdt0e-oM2ICBrMpjHnT8vEP-jhBDF7akXni6B4,655
151
- imio_smartweb_common-1.2.34.dist-info/METADATA,sha256=JFeh6emiHyRGV4mGfuD53uUt4djfKMF7OrH-swTbrc0,18277
152
- imio_smartweb_common-1.2.34.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
153
- imio_smartweb_common-1.2.34.dist-info/namespace_packages.txt,sha256=Pg8AH8t9viMMW1hJbNZvTy_n2jXG2igIYUpon5RA4Js,19
154
- imio_smartweb_common-1.2.34.dist-info/top_level.txt,sha256=ZktC0EGzThvMTAin9_q_41rzvvfMT2FYbP8pbhSLMSA,5
155
- imio_smartweb_common-1.2.34.dist-info/RECORD,,
149
+ imio_smartweb_common-1.2.35.dist-info/licenses/LICENSE.GPL,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
150
+ imio_smartweb_common-1.2.35.dist-info/licenses/LICENSE.rst,sha256=5dd78Fdt0e-oM2ICBrMpjHnT8vEP-jhBDF7akXni6B4,655
151
+ imio_smartweb_common-1.2.35.dist-info/METADATA,sha256=HSWM1e8udHYqj3o5xNpsvFb3GLCKYYcHNmk6BJpnTzU,18389
152
+ imio_smartweb_common-1.2.35.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
153
+ imio_smartweb_common-1.2.35.dist-info/namespace_packages.txt,sha256=Pg8AH8t9viMMW1hJbNZvTy_n2jXG2igIYUpon5RA4Js,19
154
+ imio_smartweb_common-1.2.35.dist-info/top_level.txt,sha256=ZktC0EGzThvMTAin9_q_41rzvvfMT2FYbP8pbhSLMSA,5
155
+ imio_smartweb_common-1.2.35.dist-info/RECORD,,