imio.smartweb.common 1.2.37__py3-none-any.whl → 1.2.38__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.
@@ -3,6 +3,7 @@
3
3
  xmlns:cache="http://namespaces.zope.org/cache"
4
4
  xmlns:zcml="http://namespaces.zope.org/zcml">
5
5
 
6
+ <include package="plone.app.caching" />
6
7
  <include package="z3c.unconfigure" file="meta.zcml" />
7
8
 
8
9
  <unconfigure>
@@ -130,24 +130,41 @@ class FindEndpointHandler(SearchHandler):
130
130
  if total == 0:
131
131
  return {}
132
132
 
133
- # Récupération des valeurs réelles dans les objets
133
+ # Récupération et normalisation des valeurs
134
134
  values = []
135
135
  for brain in brains:
136
136
  obj = brain.getObject()
137
137
  value = getattr(obj, field_name, None)
138
- if isinstance(value, (list, tuple)): # cas champ multi-valué
139
- values.extend(value)
138
+ if isinstance(value, (list, tuple)):
139
+ if not value:
140
+ # liste/tuple vide => on compte 1 None
141
+ values.append(None)
142
+ else:
143
+ mapped = [
144
+ None if (v in ("", "None") or v is None) else v for v in value
145
+ ]
146
+ # si TOUT est None, on compte 1 None (au lieu d'en ajouter 0)
147
+ if all(v is None for v in mapped):
148
+ values.append(None)
149
+ else:
150
+ values.extend(mapped)
140
151
  else:
141
- values.append(value)
152
+ v = None if (value in ("", "None") or value is None) else value
153
+ values.append(v)
142
154
  counter = Counter(values)
143
155
 
144
- # Calcul stats seulement pour expected_values
145
- result = {}
156
+ # Normalisation des valeurs attendues
146
157
  expected_values = normalize_query_param(expected_values)
147
- for val in expected_values:
148
- count = counter.get(val, 0)
158
+ # On garde les labels originaux pour l'affichage, mais on mappe "None" vers None réel pour le compteur
159
+ expected_mapping = {v: (None if v == "None" else v) for v in expected_values}
160
+
161
+ # Calcul stats
162
+ result = {}
163
+ for label, key in expected_mapping.items():
164
+ count = counter.get(key, 0)
149
165
  percent = (count / total) * 100 if total > 0 else 0
150
- result[val] = {"count": count, "percent": round(percent, 2)}
166
+ result[label] = {"count": count, "percent": round(percent, 2)}
167
+
151
168
  return result
152
169
 
153
170
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: imio.smartweb.common
3
- Version: 1.2.37
3
+ Version: 1.2.38
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,16 @@ Changelog
178
178
  =========
179
179
 
180
180
 
181
+ 1.2.38 (2025-09-10)
182
+ -------------------
183
+
184
+ - @find : Process None value in a field or ["None", "other value"] for agatha stats
185
+ [boulch
186
+
187
+ - Add plone.app.caching include for futur proofing override
188
+ [jchandelle]
189
+
190
+
181
191
  1.2.37 (2025-09-03)
182
192
  -------------------
183
193
 
@@ -1,9 +1,9 @@
1
- imio.smartweb.common-1.2.37-py3.12-nspkg.pth,sha256=XZ3YhlzwpUCC8tXtelHRqxVxo3NWomIiMsUfUshrbeE,1011
1
+ imio.smartweb.common-1.2.38-py3.12-nspkg.pth,sha256=XZ3YhlzwpUCC8tXtelHRqxVxo3NWomIiMsUfUshrbeE,1011
2
2
  imio/smartweb/common/__init__.py,sha256=Na9XBfEQUMrm2c5jbqQgwWeg40ih0aXVG1vT8NeAjMQ,2709
3
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
- imio/smartweb/common/caching_overrides.zcml,sha256=ysa5DgVGzO1Fp22d9Wg-vNyLlqfRR77WBV-7L6j0Hpo,526
6
+ imio/smartweb/common/caching_overrides.zcml,sha256=rpyKruOfuhAWfhtDVS9X54ibmNTZ9FmueH5Jz8aBf0w,570
7
7
  imio/smartweb/common/config.py,sha256=imgOo0_BBIbXGFNvBnhPReLOSY4JqIOH_QCAl0j0XGI,435
8
8
  imio/smartweb/common/configure.zcml,sha256=Ypqlo27RCC_w48QaQ0xucQRDjIBs9VpdtoJSjionK6Y,1128
9
9
  imio/smartweb/common/contact_utils.py,sha256=Pr-Nhz9MRnfirZ7RbmF5JZw9fX4gWa0dWkvJlQBiDKY,11341
@@ -76,7 +76,7 @@ imio/smartweb/common/profiles/testing/types/Folder.xml,sha256=RPxIPgViAK0GGGTPKb
76
76
  imio/smartweb/common/profiles/uninstall/browserlayer.xml,sha256=glaCGlITwc36-1Fi2z0VCbLcoQ5GddkAhuW-SGYeZy8,130
77
77
  imio/smartweb/common/rest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
78
78
  imio/smartweb/common/rest/configure.zcml,sha256=eT5gr-PcfMRxQzMME7T3nzz2Y0BVI4r9HyKHIccQC2s,575
79
- imio/smartweb/common/rest/endpoint.py,sha256=hgQsZW8VV9kOiupnSJfSTcXEecv2iAn76KSum5ysjnY,6712
79
+ imio/smartweb/common/rest/endpoint.py,sha256=6HUaGF4KgC7p0-0XSVGgUAP7WG8at1052l_zCjIkquE,7494
80
80
  imio/smartweb/common/rest/odwb.py,sha256=zRZxowUaE76xlW_blc92vRCzToUpnzw3O5mxFXaeScU,2249
81
81
  imio/smartweb/common/rest/search_filters.py,sha256=upZAZ6h50qiSXo0q22lUgNlcmX5elFtrIQs_jFBl1-s,3832
82
82
  imio/smartweb/common/rest/utils.py,sha256=9zc5ge_DmVuexxN09c3U6QAITAI1s2hc0m6eZuylSxM,1269
@@ -148,10 +148,10 @@ imio/smartweb/common/viewlets/skip_to_content.py,sha256=wm22NUf8Qh5uzz8p4vkLCdFN
148
148
  imio/smartweb/common/widgets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
149
149
  imio/smartweb/common/widgets/select.py,sha256=5sV0UIgwu4AvwpgVmJeSZwUWz7OPD9VxYMowfmjcfbA,1313
150
150
  imio/smartweb/common/widgets/templates/ajaxselect_display.pt,sha256=v8TT2Xc19er6SUGWabgNfIdrayFYIjxyLK9H_XkIG3M,1209
151
- imio_smartweb_common-1.2.37.dist-info/licenses/LICENSE.GPL,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
152
- imio_smartweb_common-1.2.37.dist-info/licenses/LICENSE.rst,sha256=5dd78Fdt0e-oM2ICBrMpjHnT8vEP-jhBDF7akXni6B4,655
153
- imio_smartweb_common-1.2.37.dist-info/METADATA,sha256=kCY4-SImXYTNlaTQ8SA2iHzNOjaM2B8-wSxhJz_Q-ts,18813
154
- imio_smartweb_common-1.2.37.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
155
- imio_smartweb_common-1.2.37.dist-info/namespace_packages.txt,sha256=Pg8AH8t9viMMW1hJbNZvTy_n2jXG2igIYUpon5RA4Js,19
156
- imio_smartweb_common-1.2.37.dist-info/top_level.txt,sha256=ZktC0EGzThvMTAin9_q_41rzvvfMT2FYbP8pbhSLMSA,5
157
- imio_smartweb_common-1.2.37.dist-info/RECORD,,
151
+ imio_smartweb_common-1.2.38.dist-info/licenses/LICENSE.GPL,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
152
+ imio_smartweb_common-1.2.38.dist-info/licenses/LICENSE.rst,sha256=5dd78Fdt0e-oM2ICBrMpjHnT8vEP-jhBDF7akXni6B4,655
153
+ imio_smartweb_common-1.2.38.dist-info/METADATA,sha256=fdTxjcsoQJD07U_hYF5HBvcyhNXJWkTHaKJfkIvycLI,19026
154
+ imio_smartweb_common-1.2.38.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
155
+ imio_smartweb_common-1.2.38.dist-info/namespace_packages.txt,sha256=Pg8AH8t9viMMW1hJbNZvTy_n2jXG2igIYUpon5RA4Js,19
156
+ imio_smartweb_common-1.2.38.dist-info/top_level.txt,sha256=ZktC0EGzThvMTAin9_q_41rzvvfMT2FYbP8pbhSLMSA,5
157
+ imio_smartweb_common-1.2.38.dist-info/RECORD,,